Skip to content

Commit

Permalink
Initiate deorbit burn for the i386-only a.out related support. Moves are
Browse files Browse the repository at this point in the history
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


git-svn-id: svn+ssh://svn.freebsd.org/base/head@103436 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
  • Loading branch information
peter committed Sep 17, 2002
1 parent 6f73c04 commit 51caeea
Show file tree
Hide file tree
Showing 89 changed files with 84 additions and 922 deletions.
14 changes: 2 additions & 12 deletions Makefile
Expand Up @@ -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
Expand All @@ -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.
#
# ----------------------------------------------------------------------------
#
#
Expand Down Expand Up @@ -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
Expand All @@ -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 "--------------------------------------------------------------"

#
Expand Down
13 changes: 5 additions & 8 deletions Makefile.inc1
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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}; \
Expand Down Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions etc/Makefile
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions etc/mtree/BSD.usr.dist
Expand Up @@ -38,10 +38,6 @@
..
..
libexec
aout
..
elf
..
lpr
ru
..
Expand Down
20 changes: 8 additions & 12 deletions etc/rc
Expand Up @@ -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
Expand Down
20 changes: 8 additions & 12 deletions etc/rc.d/ldconfig
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions gnu/lib/Makefile
Expand Up @@ -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)
Expand Down
7 changes: 0 additions & 7 deletions gnu/lib/libgcc/Makefile
Expand Up @@ -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.
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gnu/usr.bin/binutils/Makefile.inc
@@ -1,6 +1,6 @@
#
# $FreeBSD$
#
.include "../Makefile.inc"

BINDIR?= /usr/libexec/elf
WARNS?= 3
1 change: 0 additions & 1 deletion gnu/usr.bin/cc/c++filt/Makefile
Expand Up @@ -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)\"
Expand Down
4 changes: 0 additions & 4 deletions gnu/usr.bin/cc/cc_int/Makefile
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gnu/usr.bin/gzip/Makefile
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gnu/usr.bin/gzip/match.S
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions include/link.h
Expand Up @@ -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
4 changes: 2 additions & 2 deletions lib/Makefile
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions lib/libc/amd64/SYS.h
Expand Up @@ -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
79 changes: 1 addition & 78 deletions lib/libc/gen/dlfcn.c
Expand Up @@ -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>

Expand Down Expand Up @@ -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__ */

0 comments on commit 51caeea

Please sign in to comment.