Commit 5ddc841a authored by Ian Lynagh's avatar Ian Lynagh

On Windows, detect if DLLs have too many symbols; trac #5987

The test isn't very pretty; it involves trawling through the
objdump -p output. I couldn't find an easier way, unfortuantely.
parent 30b5ba9b
......@@ -336,6 +336,7 @@ then
CC="${mingwbin}gcc.exe"
LD="${mingwbin}ld.exe"
NM="${mingwbin}nm.exe"
OBJDUMP="${mingwbin}objdump.exe"
fp_prog_ar="${mingwbin}ar.exe"
if ! test -d inplace/perl ||
......@@ -446,6 +447,12 @@ FP_ARG_WITH_PATH_GNU_PROG([NM], [nm], [nm])
NmCmd="$NM"
AC_SUBST([NmCmd])
dnl ** Which objdump to use?
dnl --------------------------------------------------------------
FP_ARG_WITH_PATH_GNU_PROG([OBJDUMP], [objdump], [objdump])
ObjdumpCmd="$OBJDUMP"
AC_SUBST([ObjdumpCmd])
dnl ** Which LLVM llc to use?
dnl --------------------------------------------------------------
FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL([LLC], [llc])
......
......@@ -714,6 +714,7 @@ DTRACE = @DtraceCmd@
LD = @LdCmd@
NM = @NmCmd@
OBJDUMP = @ObjdumpCmd@
LLC = @LlcCmd@
OPT = @OptCmd@
......
......@@ -69,6 +69,9 @@ $$($1_$2_$3_LIB) : $$($1_$2_$3_ALL_OBJS) $$(ALL_RTS_LIBS) $$($1_$2_$3_DEPS_LIBS)
$$(addprefix -l,$$($1_$2_EXTRA_LIBRARIES)) \
-no-auto-link-packages \
-o $$@
# Now check that the DLL doesn't have too many symbols. See trac #5987.
case `$$(OBJDUMP) -p $$@ | sed -n "1,/^.Ordinal\/Name Pointer/ D; p; /^$$$$/ q" | grep "\[ *0\]" | wc -l` in 1) echo DLL $$@ OK;; 0) echo No symbols in DLL $$@; exit 1;; [0-9]*) echo Too many symbols in DLL $$@; exit 1;; *) echo bad DLL $$@; exit 1;; esac
else
$$($1_$2_$3_LIB) : $$($1_$2_$3_ALL_OBJS) $$(ALL_RTS_LIBS) $$($1_$2_$3_DEPS_LIBS)
$$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) $$($1_$2_$3_ALL_OBJS) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment