Initiate deorbit burn for the i386-only a.out related support. Moves are

under way to move the remnants of the a.out toolchain to ports.  As the
comment in src/Makefile said, this stuff is deprecated and one should not
expect this to remain beyond 4.0-REL.  It has already lasted WAY beyond
that.

Notable exceptions:
gcc - I have not touched the a.out generation stuff there.
ldd/ldconfig - still have some code to interface with a.out rtld.
old as/ld/etc - I have not removed these yet, pending their move to ports.
some includes - necessary for ldd/ldconfig for now.

Tested on: i386 (extensively), alpha
This commit is contained in:
Peter Wemm 2002-09-17 01:49:00 +00:00
parent 4e6ef0845d
commit 66422f5b7a
89 changed files with 84 additions and 922 deletions

View File

@ -56,13 +56,6 @@
#
# See src/UPDATING `COMMON ITEMS' for more complete information.
#
# If -DWANT_AOUT is specified, a `make world' with OBJFORMAT=elf will
# update the legacy support for aout. This includes all libraries, ld.so
# and boot objects. This part of build should be regarded as
# deprecated and you should _not_ expect to be able to do this past the
# release of 4.0. You have exactly one major release to move entirely
# to elf.
#
# If TARGET_ARCH=arch (e.g. ia64, sparc64, ...) is specified you can
# cross build world for other architectures using the buildworld target,
# and once the world is built you can cross build a kernel using the
@ -87,9 +80,6 @@
# upgrade. Optionally, you can also start it with NOCONFIRM=yes and skip
# the confirmation steps.
#
# At the end of the upgrade procedure, /etc/objformat is created or
# updated to contain OBJFORMAT=elf. From then on, you're elf by default.
#
# ----------------------------------------------------------------------------
#
#
@ -132,7 +122,7 @@ STARTTIME!= LC_ALL=C date
#
world: upgrade_checks
@echo "--------------------------------------------------------------"
@echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}"
@echo ">>> elf make world started on ${STARTTIME}"
@echo "--------------------------------------------------------------"
.if target(pre-world)
@echo
@ -152,7 +142,7 @@ world: upgrade_checks
.endif
@echo
@echo "--------------------------------------------------------------"
@printf ">>> ${OBJFORMAT} make world completed on `LC_ALL=C date`\n (started ${STARTTIME})\n"
@printf ">>> elf make world completed on `LC_ALL=C date`\n (started ${STARTTIME})\n"
@echo "--------------------------------------------------------------"
#

View File

@ -156,7 +156,6 @@ WORLDTMP= ${OBJTREE}${.CURDIR}/${MACHINE_ARCH}
# /usr/games added for fortune which depend on strfile
STRICTTMPPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
TMPPATH= ${STRICTTMPPATH}:${PATH}
OBJFORMAT_PATH?= /usr/libexec
INSTALLTMP!= /usr/bin/mktemp -d -u -t install
@ -186,7 +185,6 @@ CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
MACHINE_ARCH=${TARGET_ARCH} \
MACHINE=${TARGET} \
CPUTYPE=${TARGET_CPUTYPE} \
OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \
GROFF_BIN_PATH=${WORLDTMP}/usr/bin \
GROFF_FONT_PATH=${WORLDTMP}/usr/share/groff_font \
GROFF_TMAC_PATH=${WORLDTMP}/usr/share/tmac
@ -222,11 +220,10 @@ IMAKEENV= ${CROSSENV} \
IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
# kernel stage
KMAKEENV= ${WMAKEENV} \
OBJFORMAT_PATH=${WORLDTMP}/usr/libexec:${OBJFORMAT_PATH}
KMAKEENV= ${WMAKEENV}
USRDIRS= usr/bin usr/lib/compat/aout usr/games usr/libdata/ldscripts \
usr/libexec/${OBJFORMAT} usr/sbin usr/share/misc \
usr/libexec usr/sbin usr/share/misc \
usr/share/dict \
usr/share/groff_font/devX100 \
usr/share/groff_font/devX100-12 \
@ -654,7 +651,7 @@ _xlint= usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint
cross-tools:
.for _tool in ${_btxld} ${_elf2aout} ${_elf2exe} \
gnu/usr.bin/binutils usr.bin/objformat usr.sbin/crunch/crunchide \
gnu/usr.bin/binutils usr.sbin/crunch/crunchide \
gnu/usr.bin/cc ${_xlint}
${ECHODIR} "===> ${_tool}"; \
cd ${.CURDIR}/${_tool}; \
@ -689,8 +686,8 @@ libraries:
# shared libraries for ELF.
#
_startup_libs= gnu/lib/csu gnu/lib/libgcc
.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-${OBJFORMAT})
_startup_libs+= lib/csu/${MACHINE_ARCH}-${OBJFORMAT}
.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
_startup_libs+= lib/csu/${MACHINE_ARCH}-elf
.else
_startup_libs+= lib/csu/${MACHINE_ARCH}
.endif

View File

@ -60,9 +60,6 @@ FREEBSD=COPYRIGHT
distribute:
cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION}
.if defined(OBJFORMAT)
echo OBJFORMAT=${OBJFORMAT} > ${DISTDIR}/${DISTRIBUTION}/etc/objformat
.endif
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints \
${DISTDIR}/${DISTRIBUTION}/boot/device.hints

View File

@ -38,10 +38,6 @@
..
..
libexec
aout
..
elf
..
lpr
ru
..

20
etc/rc
View File

@ -698,18 +698,14 @@ case ${ldconfig_insecure} in
;;
esac
if [ -x /sbin/ldconfig ]; then
case `/usr/bin/objformat` in
elf)
_LDC=/usr/lib
for i in ${ldconfig_paths}; do
if [ -d "${i}" ]; then
_LDC="${_LDC} ${i}"
fi
done
echo 'ELF ldconfig path:' ${_LDC}
${ldconfig} -elf ${_LDC}
;;
esac
_LDC=/usr/lib
for i in ${ldconfig_paths}; do
if [ -d "${i}" ]; then
_LDC="${_LDC} ${i}"
fi
done
echo 'ELF ldconfig path:' ${_LDC}
${ldconfig} ${_LDC}
# Legacy aout support for i386 only
case `sysctl -n hw.machine_arch` in

View File

@ -23,18 +23,14 @@ ldconfig_start()
ldconfig=${ldconfig_command}
checkyesno ldconfig_insecure && ldconfig="${ldconfig} -i"
if [ -x "${ldconfig_command}" ]; then
case `/usr/bin/objformat` in
elf)
_LDC=/usr/lib
for i in ${ldconfig_paths}; do
if [ -d "${i}" ]; then
_LDC="${_LDC} ${i}"
fi
done
echo 'ELF ldconfig path:' ${_LDC}
${ldconfig} -elf ${_LDC}
;;
esac
_LDC=/usr/lib
for i in ${ldconfig_paths}; do
if [ -d "${i}" ]; then
_LDC="${_LDC} ${i}"
fi
done
echo 'ELF ldconfig path:' ${_LDC}
${ldconfig} -elf ${_LDC}
# Legacy aout support for i386 only
case `sysctl -n hw.machine_arch` in

View File

@ -2,12 +2,6 @@
SUBDIR= csu libgcc libdialog libregex libreadline
.if ${OBJFORMAT} == aout
.if !defined(NOLIBC_R)
SUBDIR+= libgcc_r
.endif
.endif
# libsupc++ uses libstdc++ headers, although 'make includes' should
# have taken care of that already.
.if !defined(NO_CXX)

View File

@ -13,11 +13,6 @@ LIB= gcc
#SHLIB_MAJOR= 1
#SHLIB_MINOR= 0
.if ${OBJFORMAT} == aout
# Install libgcc_pic.a, since ld.so uses it.
INSTALL_PIC_ARCHIVE= yes
.endif
#
# XXX This is a hack, but it seems to work.
# libgcc2.a is meant to be compiled by *this* version of gcc.
@ -37,9 +32,7 @@ XCXX= ${CXX}
CFLAGS+= -fexceptions
CFLAGS+= -DIN_GCC -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \
-DFINE_GRAINED_LIBRARIES
.if ${OBJFORMAT} != aout
CFLAGS+= -D_PTHREADS -DGTHREAD_USE_WEAK
.endif
CFLAGS+= -I${.CURDIR}/../../usr.bin/cc/cc_tools \
-I${GCCDIR}/config -I${GCCDIR} -I.
LDFLAGS= -nostdlib

View File

@ -1,6 +1,6 @@
#
# $FreeBSD$
#
.include "../Makefile.inc"
BINDIR?= /usr/libexec/elf
WARNS?= 3

View File

@ -6,7 +6,6 @@
PROG= c++filt
SRCS= cp-demangle.c cplus-dem+%DIKED.c
BINDIR= /usr/libexec/${OBJFORMAT}
NOMAN= 1
CFLAGS+= -DMAIN -DIN_GCC -DVERSION=\"$(version)\"

View File

@ -71,11 +71,7 @@ CFLAGS+= -DTARGET_NAME=\"${target}\" -DIN_GCC
CFLAGS+= -DTARGET_CPU_DEFAULT=${TARGET_CPU_DEFAULT}
.endif
.if ${OBJFORMAT} == aout
UNDERSCORES= 1
.else
UNDERSCORES= 0
.endif
SRCS+= underscore.c
CLEANFILES+= underscore.c
underscore.c: Makefile

View File

@ -31,7 +31,7 @@ MLINKS+= zgrep.1 zfgrep.1 zgrep.1 zegrep.1
.endif
match.o: ${.CURDIR}/match.S
$(CC) -E -traditional ${.CURDIR}/match.S >_match.s
$(CC) -E -DNO_UNDERLINE -traditional ${.CURDIR}/match.S >_match.s
$(CC) -c _match.s
mv -f _match.o match.o
rm -f _match.s

View File

@ -14,7 +14,7 @@
/* Preprocess with -DNO_UNDERLINE if your C compiler does not prefix
* external symbols with an underline character '_'.
*/
#ifdef __ELF__ /* NO_UNDERLINE */
#ifdef NO_UNDERLINE
# define _prev prev
# define _window window
# define _match_start match_start

View File

@ -30,8 +30,4 @@
* $FreeBSD$
*/
#if (defined(FREEBSD_ELF) || defined(__ELF__)) && !defined(FREEBSD_AOUT)
#include <sys/link_elf.h>
#else
#include <sys/link_aout.h>
#endif

View File

@ -32,8 +32,8 @@ SUBDIR= ${_csu} libcom_err libcrypt libkvm msun libmd \
libstand ${_libtelnet} libufs libugidfw libusbhid ${_libvgl} \
libwrap libxpg4 liby libz
.if exists(${.CURDIR}/csu/${MACHINE_ARCH}-${OBJFORMAT})
_csu=csu/${MACHINE_ARCH}-${OBJFORMAT}
.if exists(${.CURDIR}/csu/${MACHINE_ARCH}-elf)
_csu=csu/${MACHINE_ARCH}-elf
.elif exists(${.CURDIR}/csu/${MACHINE_ARCH}/Makefile)
_csu=csu/${MACHINE_ARCH}
.else

View File

@ -58,8 +58,4 @@
/* gas messes up offset -- although we don't currently need it, do for BCS */
#define LCALL(x,y) .byte 0x9a ; .long y; .word x
#ifdef __ELF__
#define KERNCALL int $0x80 /* Faster */
#else
#define KERNCALL LCALL(7,0) /* The old way */
#endif
#define KERNCALL int $0x80

View File

@ -28,12 +28,8 @@
__FBSDID("$FreeBSD$");
/*
* Linkage to services provided by the dynamic linker. These are
* implemented differently in ELF and a.out, because the dynamic
* linkers have different interfaces.
* Linkage to services provided by the dynamic linker.
*/
#ifdef __ELF__
#include <dlfcn.h>
#include <stddef.h>
@ -107,76 +103,3 @@ dlsym(void * __restrict handle, const char * __restrict name)
_rtld_error(sorry);
return NULL;
}
#else /* a.out format */
#include <sys/types.h>
#include <nlist.h> /* XXX - Required by link.h */
#include <dlfcn.h>
#include <link.h>
#include <stddef.h>
/*
* For a.out, entry to the dynamic linker is via these trampolines.
* They enter the dynamic linker through the ld_entry struct that was
* passed back from the dynamic linker at startup time.
*/
/* GCC is needed because we use its __builtin_return_address construct. */
#ifndef __GNUC__
#error "GCC is needed to compile this file"
#endif
/*
* These variables are set by code in crt0.o. For compatibility with
* old executables, they must be common, not extern.
*/
struct ld_entry *__ldso_entry; /* Entry points to dynamic linker */
int __ldso_version; /* Dynamic linker version number */
int
dladdr(const void *addr, Dl_info *dlip)
{
if (__ldso_entry == NULL || __ldso_version < LDSO_VERSION_HAS_DLADDR)
return 0;
return (__ldso_entry->dladdr)(addr, dlip);
}
int
dlclose(void *handle)
{
if (__ldso_entry == NULL)
return -1;
return (__ldso_entry->dlclose)(handle);
}
const char *
dlerror(void)
{
if (__ldso_entry == NULL)
return "Service unavailable";
return (__ldso_entry->dlerror)();
}
void *
dlopen(const char *name, int mode)
{
if (__ldso_entry == NULL)
return NULL;
return (__ldso_entry->dlopen)(name, mode);
}
void *
dlsym(void * __restrict handle, const char * __restrict name)
{
if (__ldso_entry == NULL)
return NULL;
if (__ldso_version >= LDSO_VERSION_HAS_DLSYM3) {
void *retaddr = __builtin_return_address(0); /* __GNUC__ only */
return (__ldso_entry->dlsym3)(handle, name, retaddr);
} else
return (__ldso_entry->dlsym)(handle, name);
}
#endif /* __ELF__ */

View File

@ -33,88 +33,12 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
#include <string.h>
#define PATH_OBJFORMAT "/etc/objformat"
static int copyformat(char *, const char *, size_t);
static const char *known_formats[] = { OBJFORMAT_NAMES, NULL };
static int
copyformat(char *buf, const char *fmt, size_t bufsize)
{
size_t len;
len = strlen(fmt);
if (len > bufsize - 1)
return -1;
strcpy(buf, fmt);
return len;
}
int
getobjformat(char *buf, size_t bufsize, int *argcp, char **argv)
{
const char *fmt;
char **src, **dst;
const char *env;
FILE *fp;
fmt = NULL;
if (argv != NULL) {
/*
* Scan for arguments setting known formats, e.g., "-elf".
* If "argcp" is non-NULL, delete these arguments from the
* list and update the argument count in "*argcp".
*/
for (dst = src = argv; *src != NULL; src++) {
if ((*src)[0] == '-') {
const char **p;
for (p = known_formats; *p != NULL; p++)
if (strcmp(*src + 1, *p) == 0)
break;
if (*p != NULL) {
fmt = *p;
if (argcp == NULL) /* Don't delete */
*dst++ = *src;
} else
*dst++ = *src;
} else
*dst++ = *src;
}
*dst = NULL;
if (argcp != NULL)
*argcp -= src - dst;
if (fmt != NULL)
return copyformat(buf, fmt, bufsize);
}
/* Check the OBJFORMAT environment variable. */
if ((env = getenv("OBJFORMAT")) != NULL)
return copyformat(buf, env, bufsize);
/* Take a look at "/etc/objformat". */
if ((fp = fopen(PATH_OBJFORMAT, "r")) != NULL) {
char line[1024];
int found;
int len;
found = len = 0;
while (fgets(line, sizeof line, fp) != NULL) {
if (strncmp(line, "OBJFORMAT=", 10) == 0) {
char *p = &line[10];
p[strcspn(p, " \t\n")] = '\0';
len = copyformat(buf, p, bufsize);
found = 1;
}
}
fclose(fp);
if (found)
return len;
}
/* As a last resort, use the compiled in default. */
return copyformat(buf, OBJFORMAT_DEFAULT, bufsize);
if (bufsize < 4)
return -1;
strcpy(buf, "elf");
return 3;
}

View File

@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$");
#include "libc_private.h"
#if defined(__ELF__) && (defined(__i386__) || defined(__sparc64__))
#if defined(__i386__) || defined(__sparc64__)
extern char *minbrk asm (".minbrk");
#else
extern char *minbrk asm ("minbrk");

View File

@ -58,8 +58,4 @@
/* gas messes up offset -- although we don't currently need it, do for BCS */
#define LCALL(x,y) .byte 0x9a ; .long y; .word x
#ifdef __ELF__
#define KERNCALL int $0x80 /* Faster */
#else
#define KERNCALL LCALL(7,0) /* The old way */
#endif
#define KERNCALL int $0x80

View File

@ -32,7 +32,6 @@ CLEANFILES+= md[245]hl.c md[245].ref md[245].3 mddriver \
CFLAGS+= -I${.CURDIR}
.PATH: ${.CURDIR}/${MACHINE_ARCH}
.if ${OBJFORMAT} == "elf"
.if exists(${MACHINE_ARCH}/sha.S)
SRCS+= sha.S
CFLAGS+= -DSHA1_ASM -DELF
@ -41,7 +40,6 @@ CFLAGS+= -DSHA1_ASM -DELF
SRCS+= rmd160.S
CFLAGS+= -DRMD160_ASM -DELF
.endif
.endif
md2hl.c: mdXhl.c
(echo '#define LENGTH 16'; \

View File

@ -233,18 +233,6 @@ SYMLINKS+=libncurses.a ${LIBDIR}/libtermlib.a
SYMLINKS+=libncurses.a ${LIBDIR}/libmytinfo.a
SYMLINKS+=libncurses.a ${LIBDIR}/libtinfo.a
.if !defined(NOPIC)
.if ${OBJFORMAT} == aout
SYMLINKS+=libncurses.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
libcurses.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
SYMLINKS+=libncurses.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
libtermcap.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
SYMLINKS+=libncurses.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
libtermlib.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
SYMLINKS+=libncurses.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
libmytinfo.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
SYMLINKS+=libncurses.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
libtinfo.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
.else
# no need for major at all, it's an ld-time redirection only
SYMLINKS+=libncurses.so ${SHLIBDIR}/libcurses.so
SYMLINKS+=libncurses.so ${SHLIBDIR}/libtermcap.so
@ -252,7 +240,6 @@ SYMLINKS+=libncurses.so ${SHLIBDIR}/libtermlib.so
SYMLINKS+=libncurses.so ${SHLIBDIR}/libmytinfo.so
SYMLINKS+=libncurses.so ${SHLIBDIR}/libtinfo.so
.endif
.endif
.if !defined(NOPROFILE)
SYMLINKS+=libncurses_p.a ${LIBDIR}/libcurses_p.a
SYMLINKS+=libncurses_p.a ${LIBDIR}/libtermcap_p.a

View File

@ -153,11 +153,7 @@ CLEANFILES += openpam_static.o
CLEANFILES+= openpam_static_modules.o
openpam_static_modules.o: openpam_static.o ${STATIC_MODULES}
.if ${OBJFORMAT} == elf
${LD} -o ${.TARGET} -r --whole-archive ${.ALLSRC}
.else
${LD} -o ${.TARGET} -r -Bforcearchive ${.ALLSRC}
.endif
# Headers
INCS= ${HEADERS} ${ADD_HEADERS}

View File

@ -6,31 +6,6 @@ SHLIB_MINOR= 0
SRCS= main.c yyerror.c
.if ${OBJFORMAT} != aout
NOPIC= true
.endif
#
# Before complaining about this, please *double-check* that you have
# updated the ldconfig path in /etc/rc to include /usr/lib/compat that
# was added in src/etc/rc rev 1.98.
# This is so that `ld' will not continue to generate binaries linked
# shared against liby, so that in a future release we can move this
# off to a compat dist (like compat22).
#
beforeinstall:
-rm -f ${DESTDIR}/usr/lib/compat/lib${LIB}.so \
${DESTDIR}${ORIG_SHLIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
${DESTDIR}/usr/lib/compat/lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
${DESTDIR}/usr/lib/compat/lib${LIB}.so.${SHLIB_MAJOR}
.include <bsd.lib.mk>
# This must follow the .include in case SHLIBDIR is defined there.
ORIG_SHLIBDIR:= ${SHLIBDIR}
.if ${OBJFORMAT} == aout
# The ldconfig line in/etc/rc doesn't depend on ${LIBDIR} or ${SHLIBDIR},
# so neither does this.
SHLIBDIR= /usr/lib/compat/aout
.endif

View File

@ -233,18 +233,6 @@ SYMLINKS+=libncurses.a ${LIBDIR}/libtermlib.a
SYMLINKS+=libncurses.a ${LIBDIR}/libmytinfo.a
SYMLINKS+=libncurses.a ${LIBDIR}/libtinfo.a
.if !defined(NOPIC)
.if ${OBJFORMAT} == aout
SYMLINKS+=libncurses.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
libcurses.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
SYMLINKS+=libncurses.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
libtermcap.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
SYMLINKS+=libncurses.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
libtermlib.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
SYMLINKS+=libncurses.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
libmytinfo.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
SYMLINKS+=libncurses.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
libtinfo.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
.else
# no need for major at all, it's an ld-time redirection only
SYMLINKS+=libncurses.so ${SHLIBDIR}/libcurses.so
SYMLINKS+=libncurses.so ${SHLIBDIR}/libtermcap.so
@ -252,7 +240,6 @@ SYMLINKS+=libncurses.so ${SHLIBDIR}/libtermlib.so
SYMLINKS+=libncurses.so ${SHLIBDIR}/libmytinfo.so
SYMLINKS+=libncurses.so ${SHLIBDIR}/libtinfo.so
.endif
.endif
.if !defined(NOPROFILE)
SYMLINKS+=libncurses_p.a ${LIBDIR}/libcurses_p.a
SYMLINKS+=libncurses_p.a ${LIBDIR}/libtermcap_p.a

View File

@ -23,6 +23,7 @@ SUBDIR= atrun \
rpc.rwalld \
rpc.sprayd \
rshd \
rtld-elf \
save-entropy \
talkd \
tcpd \
@ -38,13 +39,6 @@ SUBDIR+=named-xfer
SUBDIR+=mail.local smrsh
.endif
.if ${OBJFORMAT} == aout
SUBDIR+=rtld-aout
.endif
.if ${OBJFORMAT} == elf
SUBDIR+=rtld-elf
.endif
.if defined(RELEASEDIR) || \
(!exists(${.CURDIR}/../secure) && !exists(${.CURDIR}/../kerberosIV)) || \

View File

@ -44,7 +44,7 @@
#include <stdlib.h>
#include <string.h>
#include <link.h>
#include <sys/link_aout.h>
#include "shlib.h"
#include "support.h"

View File

@ -70,9 +70,6 @@ RELEASESRCMODULE?= src
RELEASEDOCMODULE?= doc
RELEASEPORTSMODULE?= ports
# Unless set elsewhere, indicate the object format we'll be using.
OBJFORMAT?= elf
# Uncomment this to disable the doc.1 target. Docs normally require
# the ports tree, so NOPORTS can be set together with NODOC in order
# to have neither ports or docs. If only NOPORTS is set to YES, but
@ -347,7 +344,6 @@ rerelease release:
( cd ${CHROOTDIR}/usr/src/sys/conf && \
mv newvers.sh foo && \
sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh && rm foo )
echo OBJFORMAT=${OBJFORMAT} > ${CHROOTDIR}/etc/objformat
-test -f install.cfg && cp install.cfg ${CHROOTDIR}/usr/src/release
echo "#!/bin/sh" > ${CHROOTDIR}/mk
echo "set -ex" >> ${CHROOTDIR}/mk
@ -357,7 +353,7 @@ rerelease release:
CD_EXTRA_BITS DISTRIBUTIONS DOMINIMALDOCPORTS \
EXTRA_SRC FIXCRYPTO KERNELS KERNEL_FLAGS \
MAKE_ISOS NODOC NOKERBEROS NOPORTS NOSHARED \
NOSRC NO_SENDMAIL OBJFORMAT RELEASETAG \
NOSRC NO_SENDMAIL RELEASETAG \
RELNOTES_LANG TARGET TARGET_ARCH WORLD_FLAGS
.if defined(${var})
echo "export ${var}=\"${${var}}\"" >> ${CHROOTDIR}/mk
@ -487,7 +483,7 @@ release.6:
@for i in ${DISTRIBUTIONS}; do \
if [ -f ${.CURDIR}/scripts/$${i}-make.sh ]; then \
echo -n "Running $$i dist creation script... "; \
env OBJFORMAT=${OBJFORMAT} RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \
env RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \
echo "Done."; \
fi \
done \

View File

@ -44,7 +44,7 @@ static const char rcsid[] =
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <link.h>
#include <sys/link_aout.h>
#include <objformat.h>
#include <stdio.h>
#include <stdlib.h>
@ -102,17 +102,18 @@ char *argv[];
{
int i, c;
int rval = 0;
char objformat[32];
int is_aout;
if (getobjformat(objformat, sizeof objformat, &argc, argv) == -1)
errx(1, "getobjformat failed: name too long");
if (strcmp(objformat, "aout") == 0)
is_aout = 0;
if (argc > 1 && strcmp(argv[1], "-aout") == 0) {
is_aout = 1;
else if (strcmp(objformat, "elf") == 0)
is_aout = 0;
else
errx(1, "unknown object format \"%s\"", objformat);
argc--;
argv++;
} else if (argc > 1 && strcmp(argv[1], "-elf") == 0) {
/* skip over legacy -elf arg */
argc--;
argv++;
}
hints_file = is_aout ? _PATH_LD_HINTS : _PATH_ELF_HINTS;
if (argc == 1)

View File

@ -153,7 +153,6 @@ cleandepend:
.if !target(checkdpadd) && (defined(DPADD) || defined(LDADD))
checkdpadd:
.if ${OBJFORMAT} != aout
@ldadd=`echo \`for lib in ${DPADD} ; do \
echo $$lib | sed 's;^/usr/lib/lib\(.*\)\.a;-l\1;' ; \
done \`` ; \
@ -163,12 +162,4 @@ checkdpadd:
echo "DPADD -> $$ldadd" ; \
echo "LDADD -> $$ldadd1" ; \
fi
.else
@dpadd=`echo \`ld -Bstatic -f ${LDADD}\`` ; \
if [ "$$dpadd" != "${DPADD}" ] ; then \
echo ${.CURDIR} ; \
echo "LDADD -> $$dpadd" ; \
echo "DPADD = ${DPADD}" ; \
fi
.endif
.endif

View File

@ -12,7 +12,6 @@
.undef SHLIB_NAME
.undef INSTALL_PIC_ARCHIVE
.else
.if ${OBJFORMAT} == elf
.if !defined(SHLIB_NAME) && defined(LIB) && defined(SHLIB_MAJOR)
SHLIB_NAME= lib${LIB}.so.${SHLIB_MAJOR}
.endif
@ -20,11 +19,6 @@ SHLIB_NAME= lib${LIB}.so.${SHLIB_MAJOR}
SHLIB_LINK?= ${SHLIB_NAME:R}
.endif
SONAME?= ${SHLIB_NAME}
.else
.if defined(SHLIB_MAJOR) && defined(SHLIB_MINOR)
SHLIB_NAME?= lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
.endif
.endif
.endif
.if defined(DEBUG_FLAGS)
@ -35,9 +29,7 @@ CFLAGS+= ${DEBUG_FLAGS}
STRIP?= -s
.endif
.if ${OBJFORMAT} != aout || make(checkdpadd) || defined(NEED_LIBNAMES)
.include <bsd.libnames.mk>
.endif
# prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
# .So used for PIC object files
@ -197,16 +189,10 @@ ${SHLIB_NAME}: ${SOBJS}
.if defined(SHLIB_LINK)
@ln -fs ${.TARGET} ${SHLIB_LINK}
.endif
.if ${OBJFORMAT} == aout
@${CC} -shared -Wl,-x,-assert,pure-text \
-o ${.TARGET} \
`lorder ${SOBJS} | tsort -q` ${LDADD}
.else
@${CC} ${LDFLAGS} -shared -Wl,-x \
-o ${.TARGET} -Wl,-soname,${SONAME} \
`lorder ${SOBJS} | tsort -q` ${LDADD}
.endif
.endif
.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
_LIBS+= lib${LIB}_pic.a
@ -243,16 +229,10 @@ _EXTRADEPEND:
> $$TMP; \
mv $$TMP ${DEPENDFILE}
.if !defined(NOEXTRADEPEND) && defined(SHLIB_NAME)
.if ${OBJFORMAT} == aout
echo ${SHLIB_NAME}: \
`${CC} -shared -Wl,-f ${LDADD}` \
>> ${DEPENDFILE}
.else
.if defined(DPADD) && !empty(DPADD)
echo ${SHLIB_NAME}: ${DPADD} >> ${DEPENDFILE}
.endif
.endif
.endif
.if !target(install)

View File

@ -21,9 +21,6 @@
# own install script so that the entire system can be made
# stripped/not-stripped using a single knob. [-s]
#
# OBJFORMAT Default object format that selects which set of tools to run.
# [elf]
#
# BINOWN Binary owner. [root]
#
# BINGRP Binary group. [wheel]
@ -123,11 +120,7 @@ KMODOWN?= ${BINOWN}
KMODGRP?= ${BINGRP}
KMODMODE?= ${BINMODE}
.if ${OBJFORMAT} == aout
LIBDIR?= /usr/lib/aout
.else
LIBDIR?= /usr/lib
.endif
LIBCOMPATDIR?= /usr/lib/compat
LIBDATADIR?= /usr/libdata
LINTLIBDIR?= /usr/libdata/lint

View File

@ -82,16 +82,11 @@ CLEANFILES+= ${PROG} ${OBJS}
.if defined(PROG)
_EXTRADEPEND:
.if ${OBJFORMAT} == aout
echo ${PROG}: `${CC} -Wl,-f ${CFLAGS} ${LDFLAGS} \
${LDADD:S/^/-Wl,/}` >> ${DEPENDFILE}
.else
echo ${PROG}: ${LIBC} ${DPADD} >> ${DEPENDFILE}
.if defined(PROG_CXX)
echo ${PROG}: ${LIBSTDCPLUSPLUS} >> ${DEPENDFILE}
.endif
.endif
.endif
.if !target(install)
@ -186,9 +181,7 @@ tags: ${SRCS}
.include <bsd.man.mk>
.endif
.if ${OBJFORMAT} != aout || make(checkdpadd) || defined(NEED_LIBNAMES)
.include <bsd.libnames.mk>
.endif
.include <bsd.dep.mk>

View File

@ -259,14 +259,6 @@ __MAKE_CONF?=/etc/make.conf
.include </etc/make.conf.local>
.endif
#
# The build tools are indirected by /usr/bin/objformat which determines the
# object format from the OBJFORMAT environment variable and if this is not
# defined, it reads /etc/objformat.
#
.if exists(/etc/objformat) && !defined(OBJFORMAT)
.include "/etc/objformat"
.endif
# Default executable format
# XXX hint for bsd.port.mk
OBJFORMAT?= elf

View File

@ -619,11 +619,9 @@ label: ASCIZ msg; \
/*
* WEAK_ALIAS: create a weak alias (ELF only).
*/
#ifdef __ELF__
#define WEAK_ALIAS(alias,sym) \
.weak alias; \
alias = sym
#endif
/*
* Kernel RCS ID tag and copyright macros
@ -631,19 +629,9 @@ label: ASCIZ msg; \
#ifdef _KERNEL
#ifdef __ELF__
#define __KERNEL_SECTIONSTRING(_sec, _str) \
.section _sec ; .asciz _str ; .text
#else /* __ELF__ */
#define __KERNEL_SECTIONSTRING(_sec, _str) \
.data ; .asciz _str ; .align 3 ; .text
#endif /* __ELF__ */
#define __KERNEL_RCSID(_n, _s) __KERNEL_SECTIONSTRING(.ident, _s)
#define __KERNEL_COPYRIGHT(_n, _s) __KERNEL_SECTIONSTRING(.copyright, _s)
#ifdef NO_KERNEL_RCSIDS
#undef __KERNEL_RCSID
#if !defined(lint) && !defined(NO_KERNEL_RCSIDS)
#define __KERNEL_RCSID(_n, _s) .ident _s
#else
#define __KERNEL_RCSID(_n, _s) /* nothing */
#endif

View File

@ -91,13 +91,6 @@
#include <machine/alpha_cpu.h>
#include <machine/cpu.h>
/*
* OBJFORMAT_NAMES is a comma-separated list of the object formats
* that are supported on the architecture.
*/
#define OBJFORMAT_NAMES "elf"
#define OBJFORMAT_DEFAULT "elf"
#ifdef SMP
#define MAXCPU 32
#else

View File

@ -58,12 +58,6 @@
#include "assym.s"
#ifdef __AOUT__
#define etext _etext
#define edata _edata
#define end _end
#endif
/*
* XXX
*

View File

@ -58,12 +58,6 @@
#include "assym.s"
#ifdef __AOUT__
#define etext _etext
#define edata _edata
#define end _end
#endif
/*
* XXX
*

View File

@ -69,13 +69,8 @@
* language name. HIDENAME is given an assembly-language name, and expands
* to a possibly-modified form that will be invisible to C programs.
*/
#ifdef __ELF__
#define CNAME(csym) csym
#define HIDENAME(asmsym) __CONCAT(.,asmsym)
#else
#define CNAME(csym) __CONCAT(_,csym)
#define HIDENAME(asmsym) asmsym
#endif
/* XXX should use .p2align 4,0x90 for -m486. */
#define _START_ENTRY .text; .p2align 2,0x90
@ -103,12 +98,8 @@
#undef __FBSDID
#if !defined(lint) && !defined(STRIP_FBSDID)
#ifdef __ELF__
#define __FBSDID(s) .ident s
#else
#define __FBSDID(s) .data ; .asciz s ; .previous
#endif
#else
#define __FBSDID(s) /* nothing */
#endif /* not lint and not STRIP_FBSDID */

View File

@ -84,13 +84,6 @@
#endif
#define MID_MACHINE MID_X86_64
/*
* OBJFORMAT_NAMES is a comma-separated list of the object formats
* that are supported on the architecture.
*/
#define OBJFORMAT_NAMES "elf"
#define OBJFORMAT_DEFAULT "elf"
#ifdef SMP
#define MAXCPU 16
#else

View File

@ -145,11 +145,7 @@ void stopguprof(struct gmonparam *p);
__BEGIN_DECLS
#ifdef __GNUC__
#ifdef __ELF__
void mcount(void) __asm(".mcount");
#else
void mcount(void) __asm("mcount");
#endif
#endif
static void _mcount(uintfptr_t frompc, uintfptr_t selfpc);
__END_DECLS

View File

@ -76,13 +76,6 @@
#include <machine/cpu.h>
/*
* OBJFORMAT_NAMES is a comma-separated list of the object formats
* that are supported on the architecture.
*/
#define OBJFORMAT_NAMES "elf"
#define OBJFORMAT_DEFAULT "elf"
#ifdef SMP
#define MAXCPU 2
#else

View File

@ -24,13 +24,8 @@ BOOT_BOOT0_TICKS?= 0xb6
BOOT_BOOT0_ORG?= 0x600
boot0: boot0.o
.if ${OBJFORMAT} == aout
${LD} -N -s -T ${BOOT_BOOT0_ORG} -o boot0.out boot0.o
dd if=boot0.out of=${.TARGET} ibs=32 skip=1
.else
${LD} -N -e start -Ttext ${BOOT_BOOT0_ORG} -o boot0.out boot0.o
objcopy -S -O binary boot0.out ${.TARGET}
.endif
boot0.o: boot0.s
${AS} ${AFLAGS} --defsym FLAGS=${BOOT_BOOT0_FLAGS} \

View File

@ -28,13 +28,8 @@ ORG= 0x9000
all: btx
btx: btx.o
.if ${OBJFORMAT} == aout
${LD} -nostdlib -N -s -T ${ORG} -o btx.out btx.o
dd if=btx.out of=${.TARGET} ibs=32 skip=1
.else
${LD} -N -e start -Ttext ${ORG} -o btx.out btx.o
objcopy -S -O binary btx.out ${.TARGET}
.endif
btx.o: btx.s
(cd ${.CURDIR}; ${M4} ${M4FLAGS} btx.s) | \

View File

@ -10,13 +10,8 @@ M4FLAGS+= -DBTXLDR_VERBOSE
all: btxldr
btxldr: btxldr.o
.if ${OBJFORMAT} == aout
${LD} -nostdlib -N -s -T ${LOADER_ADDRESS} -o btxldr.out btxldr.o
dd if=btxldr.out of=${.TARGET} ibs=32 skip=1
.else
${LD} -N -e start -Ttext ${LOADER_ADDRESS} -o btxldr.out btxldr.o
objcopy -S -O binary btxldr.out ${.TARGET}
.endif
btxldr.o: btxldr.s
(cd ${.CURDIR}; ${M4} ${M4FLAGS} btxldr.s ) | \

View File

@ -1,8 +1,6 @@
# $FreeBSD$
OBJS= btxcsu.o btxsys.o btxv86.o
AFLAGS+= -elf
LDFLAGS+= -elf
CLEANFILES+= crt0.o ${OBJS}
all: crt0.o

View File

@ -10,13 +10,8 @@ STRIP=
BINDIR?= /boot
${PROG}: ${PROG}.o
.if ${OBJFORMAT} == aout
${LD} -nostdlib -N -s -T ${ORG} -o ${PROG}.out ${PROG}.o
dd if=${PROG}.out of=${.TARGET} ibs=32 skip=1
.else
${LD} -N -e start -Ttext ${ORG} -o ${PROG}.out ${PROG}.o
objcopy -S -O binary ${PROG}.out ${.TARGET}
.endif
CLEANFILES+= ${PROG}.o ${PROG}.out

View File

@ -4,11 +4,7 @@ FILES= kgzldr.o
SRCS= start.s boot.c inflate.c lib.c crt.s sio.s
OBJS= ${SRCS:N*.h:R:S/$/.o/g}
CFLAGS= -ffreestanding
.if ${OBJFORMAT} == aout
CFLAGS+=-O2
.else
CFLAGS+=-Os
.endif
CFLAGS+=-DKZIP
LDFLAGS=-nostdlib -static -r
BINDIR= /usr/lib
@ -16,17 +12,10 @@ BINDIR= /usr/lib
CLEANFILES=${FILES}
M4?= m4
M4FLAGS=-DOBJFORMAT=${OBJFORMAT}
BOOT_COMCONSOLE_PORT?= 0x3f8
M4FLAGS+=-DSIOPRT=${BOOT_COMCONSOLE_PORT}
kgzldr.o: ${OBJS}
${CC} ${LDFLAGS} -o ${.TARGET} ${OBJS}
.s.o:
(cd ${.CURDIR}; ${M4} ${M4FLAGS} kgzldr.m4 ${.IMPSRC}) |\
${AS} ${AFLAGS} -o ${.TARGET}
.include <bsd.prog.mk>

View File

@ -38,11 +38,11 @@
.set BDA_SCR,0x449 # Video mode
.set BDA_POS,0x450 # Cursor position
.globl _(crt_putchr)
.globl crt_putchr
# void crt_putchr(int c)
_(crt_putchr): movb 0x4(%esp,1),%al # Get character
crt_putchr: movb 0x4(%esp,1),%al # Get character
pusha # Save
xorl %ecx,%ecx # Zero for loops
movb $SCR_MAT,%ah # Mode/attribute

View File

@ -1,18 +0,0 @@
#
# Copyright (c) 2000 Robert Nordier
# All rights reserved.
#
# Redistribution and use in source and binary forms are freely
# permitted provided that the above copyright notice and this
# paragraph and the following disclaimer are duplicated in all
# such forms.
#
# This software is provided "AS IS" and without any express or
# implied warranties, including, without limitation, the implied
# warranties of merchantability and fitness for a particular
# purpose.
#
# $FreeBSD$
define(_,`ifelse(OBJFORMAT,`aout',`_$1',`$1')')

View File

@ -29,11 +29,11 @@
.set SIO_PRT,SIOPRT # Base port
.globl _(sio_putchr)
.globl sio_putchr
# void sio_putchr(int c)
_(sio_putchr): movw $SIO_PRT+0x5,%dx # Line status reg
sio_putchr: movw $SIO_PRT+0x5,%dx # Line status reg
xor %ecx,%ecx # Timeout
movb $0x40,%ch # counter
sio_putchr.1: inb %dx,%al # Transmitter

View File

@ -40,6 +40,6 @@ _start: cld # String ops inc
rep # Clear
stosb # bss
pushl 0x4(%esp) # Pass howto flags
call _(boot) # Call C code
call boot # Call C code
popl %ecx # Clear stack
jmp *_(kgz)+entry # To loaded code
jmp *kgz+entry # To loaded code

View File

@ -27,23 +27,12 @@ ${BOOT}: ${BSECT} ${LDR} ${LOADER}
rm ${.TARGET}.tmp
${LDR}: ${LDR}.o
.if ${OBJFORMAT} == aout
${LD} -nostdlib -N -s -T ${ORG} -o ${LDR}.out ${LDR}.o
dd if=${LDR}.out of=${.TARGET} ibs=32 skip=1
.else
${LD} -N -e start -Ttext ${ORG} -o ${LDR}.out ${LDR}.o
objcopy -S -O binary ${LDR}.out ${.TARGET}
.endif
${BSECT}: ${BSECT}.o
.if ${OBJFORMAT} == aout
${LD} -nostdlib -N -s -T ${ORG} -o ${BSECT}.out ${BSECT}.o
dd if=${BSECT}.out of=${.TARGET} ibs=32 skip=1
.else
${LD} -N -e start -Ttext ${ORG} -o ${BSECT}.out ${BSECT}.o
objcopy -S -O binary ${BSECT}.out ${.TARGET}
.endif
${BSECT}.o: ${BSECT}.s ${LOADER}

View File

@ -9,13 +9,8 @@ BINMODE= 444
ORG= 0x600
mbr: mbr.o
.if ${OBJFORMAT} == aout
${LD} -N -s -T ${ORG} -o mbr.out mbr.o
dd if=mbr.out of=${.TARGET} ibs=32 skip=1
.else
${LD} -N -e start -Ttext ${ORG} -o mbr.out mbr.o
objcopy -S -O binary mbr.out ${.TARGET}
.endif
CLEANFILES+= mbr.out mbr.o

View File

@ -43,13 +43,8 @@ ${LOADER}: ${LOADERBIN} ${BTXLDR} ${BTXKERN} ${BTXCRT}
-b ${BTXKERN} ${LOADERBIN}
${LDR}: ${LDR}.o
.if ${OBJFORMAT} == aout
${LD} -nostdlib -N -s -T ${ORG} -o ${LDR}.out ${LDR}.o
dd if=${LDR}.out of=${.TARGET} ibs=32 skip=1
.else
${LD} -N -e start -Ttext ${ORG} -o ${LDR}.out ${LDR}.o
objcopy -S -O binary ${LDR}.out ${.TARGET}
.endif
${LDR}.o: ${LDR}.s
(cd ${.CURDIR}; ${M4} ${M4FLAGS} ${LDR}.s) | \

View File

@ -29,13 +29,8 @@ ORG= 0x9000
all: btx
btx: btx.o
.if ${OBJFORMAT} == aout
${LD} -nostdlib -N -s -T ${ORG} -o btx.out btx.o
dd if=btx.out of=${.TARGET} ibs=32 skip=1
.else
${LD} -N -e start -Ttext ${ORG} -o btx.out btx.o
objcopy -S -O binary btx.out ${.TARGET}
.endif
btx.o: btx.s
(cd ${.CURDIR}; ${M4} ${M4FLAGS} btx.s) | \

View File

@ -10,13 +10,8 @@ M4FLAGS+= -DBTXLDR_VERBOSE
all: btxldr
btxldr: btxldr.o
.if ${OBJFORMAT} == aout
${LD} -nostdlib -N -s -T ${LOADER_ADDRESS} -o btxldr.out btxldr.o
dd if=btxldr.out of=${.TARGET} ibs=32 skip=1
.else
${LD} -N -e start -Ttext ${LOADER_ADDRESS} -o btxldr.out btxldr.o
objcopy -S -O binary btxldr.out ${.TARGET}
.endif
btxldr.o: btxldr.s
(cd ${.CURDIR}; ${M4} ${M4FLAGS} btxldr.s ) | \

View File

@ -4,11 +4,7 @@ FILES= kgzldr.o
SRCS= start.s boot.c inflate.c lib.c crt.s sio.s
OBJS= ${SRCS:N*.h:R:S/$/.o/g}
CFLAGS= -ffreestanding
.if ${OBJFORMAT} == aout
CFLAGS+=-O2
.else
CFLAGS+=-Os
.endif
CFLAGS+=-DKZIP
LDFLAGS=-nostdlib -static -r
BINDIR= /usr/lib
@ -20,7 +16,6 @@ AFLAGS+=--defsym PC98=1
CLEANFILES=${FILES}
M4?= m4
M4FLAGS=-DOBJFORMAT=${OBJFORMAT}
BOOT_COMCONSOLE_PORT?= 0x238
M4FLAGS+=-DSIOPRT=${BOOT_COMCONSOLE_PORT}

View File

@ -37,7 +37,7 @@ _OS!=uname
.if ${_OS} != "FreeBSD"
CWARNFLAGS=-Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
-Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual
COPTS+= -D__ELF__ -D__FreeBSD__
COPTS+= -D__FreeBSD__
.endif
COPTS+= -msoft-float

View File

@ -52,8 +52,7 @@ ${mfile:T:S/.m$/.h/}: ${mfile}
kernel-clean:
rm -f *.o *.so *.So *.ko *.s eddep errs \
${FULLKERNEL} ${KERNEL_KO} linterrs makelinks \
setdef[01].c setdefs.h tags \
${FULLKERNEL} ${KERNEL_KO} linterrs makelinks tags \
vers.c vnode_if.c vnode_if.h \
${MFILES:T:S/.m$/.c/} ${MFILES:T:S/.m$/.h/} \
${CLEAN}
@ -77,7 +76,7 @@ hack.So: Makefile
./assym.s: assym.s
assym.s: $S/kern/genassym.sh genassym.o
NM=${NM} OBJFORMAT=elf sh $S/kern/genassym.sh genassym.o > ${.TARGET}
NM=${NM} sh $S/kern/genassym.sh genassym.o > ${.TARGET}
# XXX used to force -elf after CFLAGS to work around breakage of cc -aout
# (genassym.sh makes some assumptions and cc stopped satisfying them).

View File

@ -31,24 +31,12 @@ INCLUDES+= -I$S/contrib/dev/acpica
# ... and the same for ipfilter
INCLUDES+= -I$S/contrib/ipfilter
# This hack is to allow kernel compiles to succeed on machines w/out srcdist
.if exists($S/../include)
INCLUDES+= -I$S/../include
.else
INCLUDES+= -I/usr/include
.endif
COPTS= ${INCLUDES} -D_KERNEL -include opt_global.h
CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} -fno-common
# XXX LOCORE means "don't declare C stuff" not "for locore.s".
ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS}
# Select the correct set of tools. Can't set OBJFORMAT here because it
# doesn't get exported into the environment, and if it were exported
# then it might break building of utilities.
CFLAGS+= ${FMT}
.if defined(PROFLEVEL) && ${PROFLEVEL} >= 1
CFLAGS+= -DGPROF -falign-functions=16
.if ${PROFLEVEL} >= 2

View File

@ -106,11 +106,6 @@ LDFLAGS+= -d -warn-common
CFLAGS+= ${DEBUG_FLAGS}
.if ${OBJFORMAT} == elf
CLEANFILES+= setdef0.c setdef1.c setdefs.h
CLEANFILES+= setdef0.o setdef1.o
.endif
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
.if !defined(PROG)

View File

@ -63,11 +63,7 @@ ENTRY(bios32)
movl 16(%ebp),%esi
movl 20(%ebp),%edi
pushl %ebp
#ifdef __AOUT__
lcall bioscall_vector /* Stupid a.out gas! */
#else
lcall *bioscall_vector
#endif
popl %ebp
movl %eax,0(%ebp)
movl %ebx,4(%ebp)
@ -131,11 +127,7 @@ ENTRY(bios16_call)
lret /* ...continue below */
.globl CNAME(bios16_jmp)
CNAME(bios16_jmp):
#ifdef __AOUT__
lcallw bioscall_vector /* Stupid a.out gas! */
#else
lcallw *bioscall_vector /* 16-bit call */
#endif
jc 1f
pushl $0 /* success */

View File

@ -58,12 +58,6 @@
#include "assym.s"
#ifdef __AOUT__
#define etext _etext
#define edata _edata
#define end _end
#endif
/*
* XXX
*

View File

@ -69,13 +69,8 @@
* language name. HIDENAME is given an assembly-language name, and expands
* to a possibly-modified form that will be invisible to C programs.
*/
#ifdef __ELF__
#define CNAME(csym) csym
#define HIDENAME(asmsym) __CONCAT(.,asmsym)
#else
#define CNAME(csym) __CONCAT(_,csym)
#define HIDENAME(asmsym) asmsym
#endif
/* XXX should use .p2align 4,0x90 for -m486. */
#define _START_ENTRY .text; .p2align 2,0x90
@ -103,12 +98,8 @@
#undef __FBSDID
#if !defined(lint) && !defined(STRIP_FBSDID)
#ifdef __ELF__
#define __FBSDID(s) .ident s
#else
#define __FBSDID(s) .data ; .asciz s ; .previous
#endif
#else
#define __FBSDID(s) /* nothing */
#endif /* not lint and not STRIP_FBSDID */

View File

@ -73,13 +73,6 @@
#endif
#define MID_MACHINE MID_I386
/*
* OBJFORMAT_NAMES is a comma-separated list of the object formats
* that are supported on the architecture.
*/
#define OBJFORMAT_NAMES "elf", "aout"
#define OBJFORMAT_DEFAULT "elf"
#ifdef SMP
#define MAXCPU 16
#else

View File

@ -145,11 +145,7 @@ void stopguprof(struct gmonparam *p);
__BEGIN_DECLS
#ifdef __GNUC__
#ifdef __ELF__
void mcount(void) __asm(".mcount");
#else
void mcount(void) __asm("mcount");
#endif
#endif
static void _mcount(uintfptr_t frompc, uintfptr_t selfpc);
__END_DECLS

View File

@ -37,8 +37,6 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
/* __KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.23 1998/02/24 07:38:01 thorpej Exp $");*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>

View File

@ -164,36 +164,13 @@ label: ASCIZ msg; \
/*
* WEAK_ALIAS: create a weak alias (ELF only).
*/
#ifdef __ELF__
#define WEAK_ALIAS(alias,sym) \
.weak alias; \
alias = sym
#endif
/*
* Kernel RCS ID tag and copyright macros
* ID tag macros
*/
#ifdef _KERNEL
#ifdef __ELF__
#define __KERNEL_SECTIONSTRING(_sec, _str) \
.section _sec ; .asciz _str ; .text
#else /* __ELF__ */
#define __KERNEL_SECTIONSTRING(_sec, _str) \
.data ; .asciz _str ; .align 3 ; .text
#endif /* __ELF__ */
#define __KERNEL_RCSID(_n, _s) __KERNEL_SECTIONSTRING(.ident, _s)
#define __KERNEL_COPYRIGHT(_n, _s) __KERNEL_SECTIONSTRING(.copyright, _s)
#ifdef NO_KERNEL_RCSIDS
#undef __KERNEL_RCSID
#define __KERNEL_RCSID(_n, _s) /* nothing */
#endif
#endif /* _KERNEL */
#if !defined(lint) && !defined(STRIP_FBSDID)
#define __FBSDID(s) .ident s
#else

View File

@ -87,13 +87,6 @@
#endif
#define MID_MACHINE MID_IA64
/*
* OBJFORMAT_NAMES is a comma-separated list of the object formats
* that are supported on the architecture.
*/
#define OBJFORMAT_NAMES "elf"
#define OBJFORMAT_DEFAULT "elf"
#ifdef SMP
#define MAXCPU 16
#else

View File

@ -55,9 +55,6 @@
#include <vm/pmap.h>
#include <vm/vm_map.h>
#ifdef __AOUT__
#include <sys/nlist_aout.h>
#endif
#include <sys/link_elf.h>
#include "linker_if.h"
@ -177,19 +174,16 @@ extern struct _dynamic _DYNAMIC;
static void
link_elf_init(void* arg)
{
#ifdef __ELF__
Elf_Dyn *dp;
caddr_t modptr, baseptr, sizeptr;
elf_file_t ef;
char *modname;
#ifdef DDB
char *newfilename;
#endif
#endif
linker_add_class(&link_elf_class);
#ifdef __ELF__
dp = (Elf_Dyn*) &_DYNAMIC;
modname = NULL;
modptr = preload_search_by_type("elf kernel");
@ -240,8 +234,6 @@ link_elf_init(void* arg)
r_debug_state(NULL, NULL); /* say hello to gdb! */
#endif
#endif
}
SYSINIT(link_elf, SI_SUB_KLD, SI_ORDER_SECOND, link_elf_init, 0);

View File

@ -55,9 +55,6 @@
#include <vm/pmap.h>
#include <vm/vm_map.h>
#ifdef __AOUT__
#include <sys/nlist_aout.h>
#endif
#include <sys/link_elf.h>
#include "linker_if.h"
@ -177,19 +174,16 @@ extern struct _dynamic _DYNAMIC;
static void
link_elf_init(void* arg)
{
#ifdef __ELF__
Elf_Dyn *dp;
caddr_t modptr, baseptr, sizeptr;
elf_file_t ef;
char *modname;
#ifdef DDB
char *newfilename;
#endif
#endif
linker_add_class(&link_elf_class);
#ifdef __ELF__
dp = (Elf_Dyn*) &_DYNAMIC;
modname = NULL;
modptr = preload_search_by_type("elf kernel");
@ -240,8 +234,6 @@ link_elf_init(void* arg)
r_debug_state(NULL, NULL); /* say hello to gdb! */
#endif
#endif
}
SYSINIT(link_elf, SI_SUB_KLD, SI_ORDER_SECOND, link_elf_init, 0);

View File

@ -11,7 +11,7 @@ TR_INET6?= 0 # 0/1 requires INET6 to be configured in the kernel
TR_IPX?= 0 # 0/1 requires IPX to be configured in the kernel
trlld.o:
uudecode < ${.CURDIR}/../../contrib/dev/oltr/i386-${OBJFORMAT}.trlld.o.uu
uudecode < ${.CURDIR}/../../contrib/dev/oltr/i386-elf.trlld.o.uu
opt_inet.h:
touch opt_inet.h

View File

@ -61,11 +61,7 @@ ENTRY(bios32_apm98)
pushl %ebp
pushfl
cli
#ifdef __AOUT__
lcall bioscall_vector /* Stupid a.out gas! */
#else
lcall *bioscall_vector
#endif
movl %eax,%edi
movl %edx,%esi
lahf

View File

@ -84,11 +84,9 @@
#define __FBSDID(s) /* nothing */
#endif /* not lint and not STRIP_FBSDID */
#ifdef __ELF__
#define WEAK_ALIAS(alias,sym) \
.weak alias; \
alias = sym
#endif
#ifdef __STDC__
#define WARN_REFERENCES(_sym,_msg) \

View File

@ -80,13 +80,6 @@
#include <machine/cpu.h>
#endif
/*
* OBJFORMAT_NAMES is a comma-separated list of the object formats
* that are supported on the architecture.
*/
#define OBJFORMAT_NAMES "elf"
#define OBJFORMAT_DEFAULT "elf"
#ifdef SMP
#define MAXCPU 2
#else

View File

@ -69,13 +69,6 @@
#endif
#define MID_MACHINE MID_SPARC64
/*
* OBJFORMAT_NAMES is a comma-separated list of the object formats
* that are supported on the architecture.
*/
#define OBJFORMAT_NAMES "elf"
#define OBJFORMAT_DEFAULT "elf"
#ifdef SMP
#define MAXCPU 16
#else

View File

@ -184,7 +184,6 @@
#ifdef __GNUC__
#define __strong_reference(sym,aliassym) \
extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)));
#ifdef __ELF__
#ifdef __STDC__
#define __weak_reference(sym,alias) \
__asm__(".weak " #alias); \
@ -202,32 +201,11 @@
__asm__(".asciz \"msg\""); \
__asm__(".previous")
#endif /* __STDC__ */
#else /* !__ELF__ */
#ifdef __STDC__
#define __weak_reference(sym,alias) \
__asm__(".stabs \"_" #alias "\",11,0,0,0"); \
__asm__(".stabs \"_" #sym "\",1,0,0,0")
#define __warn_references(sym,msg) \
__asm__(".stabs \"" msg "\",30,0,0,0"); \
__asm__(".stabs \"_" #sym "\",1,0,0,0")
#else
#define __weak_reference(sym,alias) \
__asm__(".stabs \"_/**/alias\",11,0,0,0"); \
__asm__(".stabs \"_/**/sym\",1,0,0,0")
#define __warn_references(sym,msg) \
__asm__(".stabs msg,30,0,0,0"); \
__asm__(".stabs \"_/**/sym\",1,0,0,0")
#endif /* __STDC__ */
#endif /* __ELF__ */
#endif /* __GNUC__ */
#ifdef __GNUC__
#ifdef __ELF__
#define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"")
#else
#define __IDSTRING(name,string) __asm__(".data\n\t.asciz\t\"" string "\"\n\t.previous")
#endif
#else
/*
* This doesn't work in header files. But it may be better than nothing.
* The alternative is: #define __IDSTRING(name,string) [nothing]

View File

@ -34,10 +34,8 @@
* The following macros are used to declare global sets of objects, which
* are collected by the linker into a `linker_set' as defined below.
* For ELF, this is done by constructing a separate segment for each set.
* For a.out, it is done automatically by the linker.
*/
#if defined(__ELF__)
/*
* Private macros, not to be used outside this header file.
*/
@ -73,52 +71,6 @@
#define SET_LIMIT(set) \
(&__CONCAT(__stop_set_,set))
#else /* __ELF__ */
/*
* The old way. This depends on GNU ld extensions that are not widely
* available outside of the a.out format.
*
* NB: the constants defined below must match those defined in
* ld/ld.h. Since their calculation requires arithmetic, we
* can't name them symbolically (e.g., 23 is N_SETT | N_EXT).
*
* In the __MAKE_SET macro below, the line:
* static void const * const __set_##set##_sym_##sym = &sym;
* is present only to prevent the compiler from producing bogus
* warnings about unused symbols.
*/
/* Private macros */
#ifdef __UNDERSCORES__
#define __MAKE_SET(set, sym, type) \
static void const * const __set_##set##_sym_##sym = &sym; \
__asm(".stabs \"_" #set "\", " #type ", 0, 0, _" #sym)
#else
#define __MAKE_SET(set, sym, type) \
static void const * const __set_##set##_sym_##sym = &sym; \
__asm(".stabs \"" #set "\", " #type ", 0, 0, " #sym)
#endif
/* Public Macros */
#define TEXT_SET(set, sym) __MAKE_SET(set, sym, 23)
#define DATA_SET(set, sym) __MAKE_SET(set, sym, 25)
#define BSS_SET(set, sym) __MAKE_SET(set, sym, 27)
#define ABS_SET(set, sym) __MAKE_SET(set, sym, 21)
#define SET_ENTRY(set, sym) error error must provide text/data type
#define SET_DECLARE(set, ptype) \
extern struct { \
int ls_length; \
ptype *ls_items[1]; \
} set
#define SET_BEGIN(set) \
(&((set).ls_items[0]))
#define SET_LIMIT(set) \
(&((set).ls_items[(set).ls_length]))
#endif /* __ELF__ */
/*
* Iterate over all the elements of a set.
*

View File

@ -25,15 +25,10 @@ if [ ! -d ${COMPILEDIR}/${KERNELNAME} ]; then
fi
cd ${COMPILEDIR}/${KERNELNAME}
if file vers.o | grep -q ELF; then
OBJFORMAT=elf;
else
OBJFORMAT=aout;
fi
MOD_OBJS=`find modules -name \*.ko`
OBJFORMAT=${OBJFORMAT} nm -gon `echo *.o $MOD_OBJS \
nm -gon `echo *.o $MOD_OBJS \
| tr ' ' '\012' \
| egrep -v '(aicasm|genassym)'` \
| tr : ' ' | awk '

View File

@ -227,17 +227,11 @@ SUBDIR+=vacation
.if ${MACHINE_ARCH} == "i386"
# Things that don't compile on alpha or are aout specific:
SUBDIR+=ar \
doscmd \
SUBDIR+=doscmd \
ncplist \
ncplogin \
nm \
ranlib \
sasc \
size \
smbutil \
strings \
strip
smbutil
.endif
.if ${MACHINE_ARCH} == "alpha"

View File

@ -14,14 +14,7 @@ FONTHDRS= font8x8.h font8x14.h font8x16.h
CLEANFILES= ${FONTFILES} ${FONTHDRS} emsdriv.sys redir.com
XINCDIR= ${DESTDIR}${X11BASE}/include
.if ${OBJFORMAT} == "aout"
CLEANFILES+= doscmd.kernel crt0.o doscmd_loader.o
XLIBDIR= ${DESTDIR}${X11BASE}/lib/aout
LDADD= -L${DESTDIR}${LIBDIR} -lgcc -lc
DPADD= ${LIBGCC} ${LIBC}
.else
XLIBDIR= ${DESTDIR}${X11BASE}/lib
.endif
EXEGRP:= ${BINGRP}
EXEMODE= ${NOBINMODE}
@ -37,10 +30,6 @@ CFLAGS+= -DNO_X
.endif
beforeinstall:
.if ${OBJFORMAT} == "aout"
${INSTALL} -o ${BINOWN} -g ${EXEGRP} -m ${EXEMODE} \
doscmd.kernel ${DESTDIR}/usr/libexec/
.endif
${INSTALL} -o ${BINOWN} -g ${EXEGRP} -m ${EXEMODE} \
emsdriv.sys redir.com ${DESTDIR}/usr/libdata/doscmd/
${INSTALL} -o ${BINOWN} -g ${EXEGRP} -m ${SHAREMODE} \
@ -49,19 +38,7 @@ beforeinstall:
${INSTALL} -o ${BINOWN} -g ${EXEGRP} -m ${SHAREMODE} \
fonts.dir ${DESTDIR}/usr/libdata/doscmd/fonts
.if ${OBJFORMAT} == "aout"
doscmd: ${LIBCRT0} doscmd_loader.o ${LIBGCC} ${LIBC}
${CC} ${CFLAGS} ${LDFLAGS} -nostdlib -Wl,-e,start,-dc,-dp \
-o doscmd ${LIBCRT0} doscmd_loader.o -lgcc -lc
# Bogusly generated dependency to get doscmd_loader.c looked at by mkdep.
.depend: doscmd_loader.c
# Bogus dependencies to get more than one binary created by `make all'.
doscmd: ${FONTFILES} ${FONTHDRS} doscmd.kernel emsdriv.sys redir.com
.else
doscmd: ${FONTFILES} ${FONTHDRS} emsdriv.sys redir.com
.endif
cp437-8x8.pcf.gz: cp437-8x8.pcf.gz.uu
uudecode ${.CURDIR}/cp437-8x8.pcf.gz.uu
@ -96,11 +73,3 @@ redir.com: redir.com.uu
NEED_LIBNAMES= yes
.include <bsd.prog.mk>
.if ${OBJFORMAT} == "aout"
# This must be after bsd.prog.mk is included so that ${OBJS} in the
# dependency gets expanded.
doscmd.kernel: crt0.o ${OBJS} ${DPADD}
${CC} ${CFLAGS} ${LDFLAGS} -static -nostdlib -Wl,-N,-T,110000 \
-o doscmd.kernel crt0.o ${OBJS} ${LDADD}
.endif

View File

@ -34,14 +34,12 @@ __FBSDID("$FreeBSD$");
#include <arpa/inet.h>
#define FREEBSD_AOUT
#include <a.out.h>
#include <assert.h>
#include <ctype.h>
#include <err.h>
#include <fcntl.h>
#include <link.h>
#include <sys/link_aout.h>
#include <stab.h>
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,21 +1,5 @@
# $FreeBSD$
PROG= objformat
NOSHARED?= YES
LINKS+= ${BINDIR}/objformat ${BINDIR}/addr2line
LINKS+= ${BINDIR}/objformat ${BINDIR}/ar
LINKS+= ${BINDIR}/objformat ${BINDIR}/as
LINKS+= ${BINDIR}/objformat ${BINDIR}/c++filt
LINKS+= ${BINDIR}/objformat ${BINDIR}/gasp
LINKS+= ${BINDIR}/objformat ${BINDIR}/gdb
LINKS+= ${BINDIR}/objformat ${BINDIR}/ld
LINKS+= ${BINDIR}/objformat ${BINDIR}/nm
LINKS+= ${BINDIR}/objformat ${BINDIR}/objcopy
LINKS+= ${BINDIR}/objformat ${BINDIR}/objdump
LINKS+= ${BINDIR}/objformat ${BINDIR}/ranlib
LINKS+= ${BINDIR}/objformat ${BINDIR}/size
LINKS+= ${BINDIR}/objformat ${BINDIR}/strings
LINKS+= ${BINDIR}/objformat ${BINDIR}/strip
.include <bsd.prog.mk>

View File

@ -30,62 +30,26 @@
.Dt OBJFORMAT 1
.Sh NAME
.Nm objformat
.Nd reports default binary format and program deflector
.Nd reports default binary format
.Sh SYNOPSIS
.Nm
.Nm prog
.Sh DESCRIPTION
If run as
.Nm
the default object file format is reported. The two different object file
formats are
.Ar aout
and
This program os obsolete and is now just a compatability stub.
It reports the object file format as
.Ar elf .
.Pp
If invoked by any other name,
.Nm prog
is expanded to
.Pa /usr/libexec/<objformat>/prog
and executed.
.Sh DIAGNOSTICS
The
.Nm
utility returns with exit code 1
if called with an improper number of arguments, or if
.Nm prog
could not be executed.
.Sh ENVIRONMENT
.Bl -tag -width OBJFORMAT_PATH
.It Ev OBJFORMAT
If the environment variable
.Ev OBJFORMAT
is set, it overrides the default object file format.
.Ev OBJFORMAT takes precedence over
.Pa /etc/objformat .
.It Ev OBJFORMAT_PATH
If the environment variable
.Ev OBJFORMAT_PATH
is set, its value is used as the base path to
.Nm prog .
The default is
.Pa /usr/libexec .
.El
.Sh FILES
.Bl -tag -width /etc/objformat -compact
.It Pa /etc/objformat
If present, specifies the object file format to use. Syntax is
.Ql OBJFORMAT=xxx .
.El
.Sh SEE ALSO
.Xr file 1 ,
.Xr getobjformat 3
.\" .Sh STANDARDS
.Sh HISTORY
The
.Nm
command appeared in
.Fx 3.0 .
.Pp
The
.Nm
program was deprecated in
.Fx 4.0
and reduced to a compatability stub in
.Fx 5.0 .
It will be completely removed before the next release.
.Sh AUTHORS
.An -nosplit
The
@ -94,4 +58,3 @@ utility was written by
.An Peter Wemm Aq peter@netplex.com.au .
This manual page was written by
.An David O'Brien Aq obrien@NUXI.com .
.\" .Sh BUGS

View File

@ -26,58 +26,13 @@
* $FreeBSD$
*/
#include <err.h>
#include <objformat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
int
main(int argc, char **argv)
{
char objformat[32];
char *path, *chunk;
char *cmd, *newcmd = NULL;
const char *objformat_path;
if (getobjformat(objformat, sizeof objformat, &argc, argv) == -1)
errx(1, "Invalid object format");
cmd = strrchr(argv[0], '/');
if (cmd != NULL)
cmd++;
else
cmd = argv[0];
if (strcmp(cmd, "objformat") == 0) {
if (argc != 1) {
fprintf(stderr, "usage: objformat\n");
exit(1);
}
printf("%s\n", objformat);
exit(0);
}
/* 'make world' glue */
objformat_path = getenv("OBJFORMAT_PATH");
if (objformat_path == NULL)
objformat_path = "/usr/libexec";
path = strdup(objformat_path);
setenv("OBJFORMAT", objformat, 1);
while ((chunk = strsep(&path, ":")) != NULL) {
if (newcmd != NULL) {
free(newcmd);
newcmd = NULL;
}
asprintf(&newcmd, "%s/%s/%s", chunk, objformat, cmd);
if (newcmd == NULL)
err(1, "cannot allocate memory for new command");
argv[0] = newcmd;
execv(newcmd, argv);
}
err(1, "could not exec %s/%s in %s", objformat, cmd, objformat_path);
write(1, "elf\n", 4);
return (0);
}

View File

@ -13,11 +13,10 @@ CFLAGS+= -I. -I${.CURDIR}
LINTFLAGS=-aehpz
BINDIR= /usr/libexec
OBJFORMAT_PATH?= ${BINDIR} # src/Makefile.inc1 sets this
.PATH: ${.CURDIR}/../common
lint.7: makeman
sh ${.CURDIR}/makeman ${OBJFORMAT_PATH}/${PROG} -m >${.TARGET}
sh ${.CURDIR}/makeman ${BINDIR}/${PROG} -m >${.TARGET}
.include <bsd.prog.mk>

View File

@ -5,9 +5,6 @@ MAN= keyserv.8
SRCS= keyserv.c setkey.c crypt_svc.c crypt_server.c crypt.h
CFLAGS+= -DKEYSERV_RANDOM -DBROKEN_DES -I.
.if $(OBJFORMAT) == elf
CFLAGS+= -DOBJFORMAT_ELF
.endif
DPADD= ${LIBMP} ${LIBCRYPTO} ${LIBRPCSVC}
LDADD= -lmp -lcrypto -lrpcsvc

View File

@ -171,11 +171,7 @@ static void *dlhandle;
#endif
#ifndef LIBCRYPTO
#ifdef OBJFORMAT_ELF
#define LIBCRYPTO "libcrypto.so.2"
#else
#define LIBCRYPTO "libcrypto.so.2."
#endif /* OBJFORMAT_ELF */
#endif
void load_des(warn, libpath)
@ -185,37 +181,12 @@ void load_des(warn, libpath)
char dlpath[MAXPATHLEN];
if (libpath == NULL) {
#ifdef OBJFORMAT_ELF
snprintf(dlpath, sizeof(dlpath), "%s/%s", _PATH_USRLIB, LIBCRYPTO);
#else
len = strlen(LIBCRYPTO);
if ((dird = opendir(_PATH_USRLIB)) == NULL)
err(1, "opendir(/usr/lib) failed");
while ((dirp = readdir(dird)) != NULL) {
/* must have a minor number */
if (strlen(dirp->d_name) <= len)
continue;
if (!strncmp(dirp->d_name, LIBCRYPTO, len)) {
if (atoi((dirp->d_name + len + 1)) > minor) {
minor = atoi((dirp->d_name + len + 1));
snprintf(dlpath,sizeof(dlpath),"%s/%s",
_PATH_USRLIB, dirp->d_name);
}
}
}
closedir(dird);
#endif /* OBJFORMAT_ELF */
} else
snprintf(dlpath, sizeof(dlpath), "%s", libpath);
if (dlpath != NULL && (dlhandle = dlopen(dlpath, 0444)) != NULL)
#ifdef OBJFORMAT_ELF
_my_crypt = (int (*)())dlsym(dlhandle, "_des_crypt");
#else
_my_crypt = (int (*)())dlsym(dlhandle, "__des_crypt");
#endif /* OBJFORMAT_ELF */
if (_my_crypt == NULL) {
if (dlhandle != NULL)