diff --git a/src/glue.c b/src/glue.c index 7941a303c318..9387f792d621 100644 --- a/src/glue.c +++ b/src/glue.c @@ -476,28 +476,25 @@ void genObjFile(Module *m, bool multiobj) m->sshareddtor = callFuncsAndGates(m, &sshareddtors, NULL, "__modshareddtor"); m->stest = callFuncsAndGates(m, &stests, NULL, "__modtest"); - if (m->doppelganger) + if (m->doppelganger && global.params.isWindows) genModuleInfo(m); } - if (m->doppelganger) + if (!global.params.betterC) { - objc_Module_genmoduleinfo_classes(); - objmod->termfile(); - return; + if (m->doppelganger) + { + if (!global.params.isWindows) + genModuleInfo(m); + } + else + { + genModuleInfo(m); + genhelpers(m); + } } - - /* Always generate module info, because of templates and -cov. - * But module info needs the runtime library, so disable it for betterC. - */ - if (!global.params.betterC /*|| needModuleInfo()*/) - genModuleInfo(m); - - /* Always generate helper functions b/c of later templates instantiations - * with different -release/-debug/-boundscheck/-unittest flags. - */ - if (!global.params.betterC) - genhelpers(m); + else + objc_Module_genmoduleinfo_classes(); objmod->termfile(); } diff --git a/test/runnable/extra-files/test16423lib.d b/test/runnable/extra-files/test16423lib.d new file mode 100644 index 000000000000..084c13038cc8 --- /dev/null +++ b/test/runnable/extra-files/test16423lib.d @@ -0,0 +1,26 @@ +module test16423lib; + +enum classFqn = __MODULE__ ~ '.' ~ Class.stringof; + +void testFromLibrary() +{ + testTypeid(); + testFindingClassInfoFromLibrary(); +} + +private: + +class Class {} + +void testTypeid() +{ + auto c = new Class; + assert(typeid(c) !is null, "typeid not working properly"); +} + +void testFindingClassInfoFromLibrary() +{ + auto classInfo = ClassInfo.find(classFqn); + assert(classInfo !is null, "could not find class info for '" ~ classFqn ~ + "' from library"); +} diff --git a/test/runnable/extra-files/test16423main.d b/test/runnable/extra-files/test16423main.d new file mode 100644 index 000000000000..1642336de920 --- /dev/null +++ b/test/runnable/extra-files/test16423main.d @@ -0,0 +1,19 @@ +import test16423lib; + +void testFindingClassInfoFromExecutable() +{ + auto classInfo = ClassInfo.find(classFqn); + assert(classInfo !is null, "could not find class info for '" ~ classFqn ~ + "' from executable"); +} + +void testFromExecutable() +{ + testFindingClassInfoFromExecutable(); +} + +void main() +{ + testFromLibrary(); + testFromExecutable(); +} diff --git a/test/runnable/test13117.d b/test/runnable/test13117.d index 42ce95eabe0d..2b1a62bb3f1d 100644 --- a/test/runnable/test13117.d +++ b/test/runnable/test13117.d @@ -6,7 +6,7 @@ int main() auto size = thisExePath.getSize(); writeln(size); version (D_LP64) - enum limit = 1_906_432; + enum limit = 2_151_480; else enum limit = 1_900_000; return size > limit * 11 / 10; diff --git a/test/runnable/test13117b.d b/test/runnable/test13117b.d index 53d0504af208..5a1aef68d585 100644 --- a/test/runnable/test13117b.d +++ b/test/runnable/test13117b.d @@ -9,6 +9,6 @@ int main() version (D_LP64) enum limit = 2023652; else - enum limit = 1763328; + enum limit = 1977556; return size > limit * 11 / 10; } diff --git a/test/runnable/test16096.sh b/test/runnable/test16096.sh index 28fefcb5fa29..a9ba881f856d 100755 --- a/test/runnable/test16096.sh +++ b/test/runnable/test16096.sh @@ -17,4 +17,4 @@ ${RESULTS_DIR}/runnable/test16096 rm ${dir}/{test16096a.a,test16096} -echo Success >${output_file} +echo Success > "$output_file" diff --git a/test/runnable/test16423.sh b/test/runnable/test16423.sh new file mode 100755 index 000000000000..3e131faa6a7e --- /dev/null +++ b/test/runnable/test16423.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -e + +if [ $OS == "win32" -o $OS == "win64" ]; then + libext=.lib +else + libext=.a +fi + +filename_ext=`basename $0` +filename="${filename_ext%.*}" +src=runnable/extra-files +dir=${RESULTS_DIR}/runnable +output_file=${dir}/${filename_ext}.out + +$DMD -m${MODEL} -I${src} -of${dir}${SEP}${filename}lib${libext} -lib ${src}/${filename}lib.d +$DMD -m${MODEL} -I${src} -of${dir}${SEP}${filename} ${src}/${filename}main.d ${dir}/${filename}lib${libext} +${RESULTS_DIR}/runnable/${filename} + +rm ${dir}/{${filename}lib${libext},${filename}} + +echo Success > "$output_file"