From d69d2a835cfcda2e79de20d2709622336bead31c Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Tue, 6 Mar 2012 10:13:12 +0400 Subject: [PATCH 1/6] =?UTF-8?q?Fixed=20#83=20=E2=80=94=20ldc=20claim=20a?= =?UTF-8?q?=20main=20block=20when=20trying=20to=20build=20as=20shared=20li?= =?UTF-8?q?b?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gen/linker.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gen/linker.cpp b/gen/linker.cpp index 3bf0e8f4..42688ad7 100644 --- a/gen/linker.cpp +++ b/gen/linker.cpp @@ -272,12 +272,14 @@ int linkObjToBinary(bool sharedLib) else output.append(libExt); } - args.push_back("-shared"); } else if (global.params.os == OSWindows && !endsWith(output, ".exe")) { output.append(".exe"); } } + if (sharedLib) + args.push_back("-shared"); + args.push_back("-o"); args.push_back(output.c_str()); From 120bf4429ca3dbe5778f914c0c2168c0e74780dd Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Tue, 6 Mar 2012 10:18:45 +0400 Subject: [PATCH 2/6] Partially reverted fix for #66. ldc still supports -soname switch but does not set soname by default as suggested in issue #66. --- gen/linker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gen/linker.cpp b/gen/linker.cpp index 42688ad7..33bf2c5c 100644 --- a/gen/linker.cpp +++ b/gen/linker.cpp @@ -350,7 +350,7 @@ int linkObjToBinary(bool sharedLib) OutBuffer buf; if (opts::createSharedLib && addSoname) { - std::string soname = opts::soname.getNumOccurrences() == 0 ? output : opts::soname; + std::string soname = opts::soname; if (!soname.empty()) { buf.writestring("-Wl,-soname,"); buf.writestring(soname.c_str()); From f6111f23f210c78b590a85cffebf987951fc0540 Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Tue, 6 Mar 2012 10:47:24 +0400 Subject: [PATCH 3/6] =?UTF-8?q?Fixed=20#85=20=E2=80=94=20ICE=20with=20a=20?= =?UTF-8?q?non-POD=20local=20struct=20literal=20in=20a=20class=20method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gen/toir.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gen/toir.cpp b/gen/toir.cpp index 7579726f..e0a31517 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -2881,7 +2881,7 @@ DValue* StructLiteralExp::toElem(IRState* p) #if DMDV2 else if (vd == sd->vthis) { IF_LOG Logger::println("initializing vthis"); - val = new DImValue(Type::tvoidptr, DtoBitCast(DtoNestedContext(loc, sd), getVoidPtrType())); + val = new DImValue(vd->type, DtoBitCast(DtoNestedContext(loc, sd), DtoType(vd->type))); } #endif else From 598942bd787d2cfc1e181857474fdf7a6fb10bc3 Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Tue, 6 Mar 2012 11:29:30 +0400 Subject: [PATCH 4/6] =?UTF-8?q?Fixed=20#28=20=E2=80=94=2064-bit=20unions?= =?UTF-8?q?=20are=20not=20the=20same=20size=20as=20C=20language=20unions?= =?UTF-8?q?=20in=20some=20situations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dmd2/struct.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/dmd2/struct.c b/dmd2/struct.c index 4d6d2d33..b2ffef2a 100644 --- a/dmd2/struct.c +++ b/dmd2/struct.c @@ -233,13 +233,10 @@ void AggregateDeclaration::addField(Scope *sc, VarDeclaration *v) if (!isUnionDeclaration()) sc->offset = ofs; #endif -#if !IN_LLVM - if (global.params.is64bit && sc->structalign == 8 && memalignsize == 16) + if (global.params.is64bit && sc->structalign == 8 && memalignsize == 16 && isUnionDeclaration()) /* Not sure how to handle this */ ; - else -#endif - if (sc->structalign < memalignsize) + else if (sc->structalign < memalignsize) memalignsize = sc->structalign; if (alignsize < memalignsize) alignsize = memalignsize; From c4414a2f3f577a20aa379c77063f96a38a630d90 Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Tue, 6 Mar 2012 12:10:02 +0400 Subject: [PATCH 5/6] CMake: fixed path to phobos --- ldc2_phobos.conf.in | 4 ++-- runtime/CMakeLists.txt | 16 +++++++--------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/ldc2_phobos.conf.in b/ldc2_phobos.conf.in index d4400c02..1e8d68c3 100644 --- a/ldc2_phobos.conf.in +++ b/ldc2_phobos.conf.in @@ -12,7 +12,7 @@ default: "-I@RUNTIME_DIR@/src", "-I@PHOBOS2_DIR@/", "-L-L@PROJECT_BINARY_DIR@/../lib", @MUTILIB_ADDITIONAL_PATH@ - "-defaultlib=phobos2-ldc", - "-debuglib=phobos2-ldc" + "-defaultlib=phobos-ldc", + "-debuglib=phobos-ldc" ]; }; diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index c5455fc1..4e212e04 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -13,8 +13,10 @@ endif() include(CheckTypeSize) check_type_size(void* ptr_size) if(${ptr_size} MATCHES "^8$") ## if it's 64-bit OS - set(IS_64BIT_OS 1) -endif(${ptr_size} MATCHES "^8$") + set(MULTILIB_SUFFIX 32) +else() + set(MULTILIB_SUFFIX 64) +endif() set(DMDFE_MINOR_VERSION 0 CACHE INT "Minor version of dmd frontend") set(DMDFE_PATCH_VERSION 58 CACHE INT "Patch version of dmd frontend") @@ -136,8 +138,8 @@ endif(NOT LDC_LOC) # if(MULTILIB) - set(MUTILIB_ADDITIONAL_PATH "\n \"-L-L${CMAKE_BINARY_DIR}/lib32\",") - set(MUTILIB_ADDITIONAL_INSTALL_PATH "\n \"-L-L${CMAKE_INSTALL_PREFIX}/lib32\",") + set(MUTILIB_ADDITIONAL_PATH "\n \"-L-L${CMAKE_BINARY_DIR}/lib${MULTILIB_SUFFIX}\",") + set(MUTILIB_ADDITIONAL_INSTALL_PATH "\n \"-L-L${CMAKE_INSTALL_PREFIX}/lib${MULTILIB_SUFFIX}\",") endif(MULTILIB) configure_file(${PROJECT_PARENT_DIR}/${CONFIG_NAME}.conf.in ${PROJECT_BINARY_DIR}/../bin/${LDC_EXE}.conf) @@ -335,11 +337,7 @@ endif(PHOBOS2_DIR) build_runtime("" "" "" "" "${LIB_SUFFIX}") set(GENERATE_DI "") if(MULTILIB) - if(IS_64BIT_OS) - build_runtime("-m32" "-m32" "-m32" "" "32") - else(IS_64BIT_OS) - build_runtime("-m64" "-m64" "-m64" "" "64") - endif(IS_64BIT_OS) + build_runtime("-m${MULTILIB_SUFFIX}" "-m${MULTILIB_SUFFIX}" "-m${MULTILIB_SUFFIX}" "" "${MULTILIB_SUFFIX}") endif(MULTILIB) # From 63a89bae0eb4da861863193c17ce35c56df28b31 Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Tue, 6 Mar 2012 12:20:18 +0400 Subject: [PATCH 6/6] CMake: DMD frontend version should not be stored to cache --- runtime/CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 4e212e04..45e665a8 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -18,9 +18,10 @@ else() set(MULTILIB_SUFFIX 64) endif() -set(DMDFE_MINOR_VERSION 0 CACHE INT "Minor version of dmd frontend") -set(DMDFE_PATCH_VERSION 58 CACHE INT "Patch version of dmd frontend") -set(DMDFE_VERSION ${D_VERSION}.${DMDFE_MINOR_VERSION}.${DMDFE_PATCH_VERSION} CACHE INT "Version of dmd frontend") +set(DMDFE_MINOR_VERSION 0) +set(DMDFE_PATCH_VERSION 58) +set(DMDFE_VERSION ${D_VERSION}.${DMDFE_MINOR_VERSION}.${DMDFE_PATCH_VERSION}) + set(MULTILIB OFF CACHE BOOL "Build both 64-bit and 32-bit libraries") set(BUILD_BC_LIBS OFF CACHE BOOL "Build the runtime as bytecode libraries") set(BUILD_SINGLE_LIB ON CACHE BOOL "Build single runtime library")