Kill off OMF support

This commit is contained in:
richard (rikki) andrew cattermole 2024-05-03 18:24:36 +12:00
parent e5d7779794
commit ad6e0c7a27
6 changed files with 25 additions and 74 deletions

View file

@ -28,15 +28,8 @@ echo "GREP_VERSION: $(grep --version)"
GNU_MAKE="$(which make)" # must be done before installing dmc (tampers with PATH)
if [ "$MODEL" == "32omf" ] ; then
install_host_dmc
CC="$PWD/dm/bin/dmc.exe"
CXX="$PWD/dm/bin/dmc.exe"
export CPPCMD="$PWD/dm/bin/sppn.exe"
else
CC="cl.exe"
CXX="cl.exe"
fi
CC="cl.exe"
CXX="cl.exe"
################################################################################
# Install the host compiler
@ -63,8 +56,9 @@ if [ "$MODEL" == "64" ] ; then
LIBNAME=phobos64.lib
elif [ "$MODEL" == "32" ] ; then
LIBNAME=phobos32mscoff.lib
else # 32omf
LIBNAME=phobos.lib
else
echo 'Invalid $MODEL provided'.
exit 1
fi
################################################################################
@ -79,9 +73,6 @@ fi
# avoid the DMC runtime and its limitations for the compiler and {build,run}.d tools themselves
TOOL_MODEL="$MODEL"
if [[ "$MODEL" == "32omf" ]]; then
TOOL_MODEL=32
fi
cd "$DMD_DIR"
"$HOST_DC" -m$TOOL_MODEL compiler/src/build.d -ofgenerated/build.exe
@ -115,25 +106,6 @@ fi
"$HOST_DC" -m$TOOL_MODEL -g -i run.d
if [ "$MODEL" == "32omf" ] ; then
# Pre-build the tools while the host compiler's sc.ini is untampered (see below).
./run tools
# WORKAROUND: Make Optlink use freshly built Phobos, not the host compiler's.
# Optlink apparently prefers LIB in sc.ini (in the same dir as optlink.exe)
# over the LIB env variable (and `-conf=` for DMD apparently doesn't prevent
# that, and there's apparently no sane way to specify a libdir for Optlink
# in the DMD cmdline either).
rm "$DMD_DIR/tools/dmd2/windows/bin/sc.ini"
# We also need to remove LIB from the freshly built compiler's sc.ini -
# not all test invocations use `-conf=`.
sed -i 's|^LIB=.*$||g' "$DMD_DIR/generated/windows/release/$TOOL_MODEL/sc.ini"
# Okay, now the lib directories are controlled by the LIB env variable.
# run.d prepends the dir containing freshly built phobos.lib; we still need
# the DMC and Windows libs from the host compiler.
export LIB="$DMD_DIR/tools/dmd2/windows/lib"
fi
targets=("all")
args=('ARGS=-O -inline -g') # no -release for faster builds
if [ "$HOST_DMD_VERSION" = "2.079.0" ] ; then
@ -159,31 +131,25 @@ fi
cd "$DMD_DIR/druntime"
"$GNU_MAKE" -j$N MODEL=$MODEL DMD="$DMD_BIN_PATH" CC="$CC" unittest
if [ "$MODEL" != "32omf" ] ; then
# run some tests for shared druntime
# run some tests for shared druntime
# no separate output for static or shared builds, so clean directories to force rebuild
rm -rf test/shared/generated
# the test_runner links against libdruntime-ut.dll and runs all unittests
# no matter what module name is passed in, so restrict to src/object.d
"$GNU_MAKE" -j$N unittest MODEL=$MODEL SHARED=1 DMD="$DMD_BIN_PATH" CC="$CC" UT_SRCS=src/object.d ADDITIONAL_TESTS=test/shared
fi
# no separate output for static or shared builds, so clean directories to force rebuild
rm -rf test/shared/generated
# the test_runner links against libdruntime-ut.dll and runs all unittests
# no matter what module name is passed in, so restrict to src/object.d
"$GNU_MAKE" -j$N unittest MODEL=$MODEL SHARED=1 DMD="$DMD_BIN_PATH" CC="$CC" UT_SRCS=src/object.d ADDITIONAL_TESTS=test/shared
################################################################################
# Build and run Phobos unittests
################################################################################
if [ "$MODEL" = "32omf" ] ; then
echo "FIXME: cannot compile 32-bit OMF Phobos unittests ('more than 32767 symbols in object file')"
cd "$DMD_DIR/../phobos"
if [ "$MODEL" = "64" ] ; then
cp "$DMD_DIR/tools/dmd2/windows/bin64/libcurl.dll" .
else
cd "$DMD_DIR/../phobos"
if [ "$MODEL" = "64" ] ; then
cp "$DMD_DIR/tools/dmd2/windows/bin64/libcurl.dll" .
else
cp "$DMD_DIR/tools/dmd2/windows/bin/libcurl.dll" .
fi
"$GNU_MAKE" -j$N MODEL=$MODEL DMD="$DMD_BIN_PATH" CC="$CC" DMD_DIR="$DMD_DIR" unittest
cp "$DMD_DIR/tools/dmd2/windows/bin/libcurl.dll" .
fi
"$GNU_MAKE" -j$N MODEL=$MODEL DMD="$DMD_BIN_PATH" CC="$CC" DMD_DIR="$DMD_DIR" unittest
################################################################################
# Prepare artifacts

View file

@ -30,9 +30,6 @@ jobs:
x64:
MODEL: 64
ARCH: x64
x86-OMF:
MODEL: 32omf
ARCH: x86
x86:
MODEL: 32
ARCH: x86
@ -54,11 +51,6 @@ jobs:
x64:
MODEL: 64
ARCH: x64
# x64 only because 32bit causes weird linker errors for several tests???
# x86-OMF:
# MODEL: 32omf
# ARCH: x86
steps:
- template: .azure-pipelines/windows.yml

View file

@ -0,0 +1,5 @@
Windows OMF support has been removed
After two years of making PE-COFF support the default on Windows, OMF support has now been removed.
This includes the switch (``-m32omf``).

View file

@ -71,13 +71,12 @@ There are currently 49 checks.
- Azure pipelines (Windows_Coverage x64)
- Azure pipelines (Windows_DMD_bootstrap x64)
- Azure pipelines (Windows_DMD_latest x64)
- Azure pipelines (Windows_DMD_latest x86-OMF)
- Azure pipelines (Windows_VisualD_LDC x64_Debug)
- Azure pipelines (Windows_VisualD_LDC x86-mscoff)
- Azure pipelines (Windows_VisualD_LDC x86-mscoff_MinGW)
Azure pipelines run on Windows platforms, and build DMD, Phobos and Druntime, and run their unittests.
Windows has three binary formats: 32-bit OMF (deprecated), 32-bit COFF, and 64-bit COFF.
Windows has two binary formats: 32-bit COFF, and 64-bit COFF.
### DAutoTest

View file

@ -536,12 +536,6 @@ dmd -cov -unittest myprog.d
"generate 32 bit code and write MS-COFF object files (deprecated use -m32)",
TargetOS.Windows
),
Option("m32omf",
"(deprecated) generate 32 bit code and write OMF object files",
`$(WINDOWS Compile a 32 bit executable. The generated object code is in OMF and is meant to be used with the
$(LINK2 http://www.digitalmars.com/download/freecompiler.html, Digital Mars C/C++ compiler)).`,
TargetOS.Windows
),
Option("m64",
"generate 64 bit code",
`$(UNIX Compile a 64 bit executable. This is the default for the 64 bit dmd.)

View file

@ -276,7 +276,7 @@ void getenv_setargv(const(char)* envvalue, Strings* args)
}
/**
* Parse command line arguments for the last instance of -m32, -m64, -m32mscoff or -m32omfobj
* Parse command line arguments for the last instance of -m32, -m64, -m32mscoff
* to detect the desired architecture.
*
* Params:
@ -285,7 +285,7 @@ void getenv_setargv(const(char)* envvalue, Strings* args)
* Should be "32" or "64"
*
* Returns:
* "32", "64" or "32omf" if the "-m32", "-m64", "-m32omf" flags were passed,
* "32", or "64" if the "-m32", "-m64" flags were passed,
* respectively. If they weren't, return `arch`.
*/
const(char)[] parse_arch_arg(Strings* args, const(char)[] arch)
@ -296,7 +296,7 @@ const(char)[] parse_arch_arg(Strings* args, const(char)[] arch)
if (arg.length && arg[0] == '-')
{
if (arg[1 .. $] == "m32" || arg[1 .. $] == "m32omf" || arg[1 .. $] == "m64")
if (arg[1 .. $] == "m32" || arg[1 .. $] == "m64")
arch = arg[2 .. $];
else if (arg[1 .. $] == "m32mscoff")
arch = "32";
@ -901,11 +901,6 @@ bool parseCommandLine(const ref Strings arguments, const size_t argc, ref Param
target.isX86_64 = false;
target.omfobj = false;
}
else if (arg == "-m32omf") // https://dlang.org/dmd.html#switch-m32omfobj
{
target.isX86_64 = false;
target.omfobj = true;
}
else if (startsWith(p + 1, "mscrtlib="))
{
driverParams.mscrtlib = arg[10 .. $];