commit:     be92bd625289f6c2167917761dd4690cc62986d0
Author:     Marco Leise <marco.leise <AT> gmx <DOT> de>
AuthorDate: Fri Aug 14 19:59:19 2020 +0000
Commit:     Marco Leise <marco.leise <AT> gmx <DOT> de>
CommitDate: Sat Aug 15 01:34:45 2020 +0000
URL:        https://gitweb.gentoo.org/repo/user/dlang.git/commit/?id=be92bd62

Fixed an issue where ldc2 would not build with dmd, because "-Wl,--icf=safe" 
wasn't correctly filtered out of LDFLAGS if set.

Signed-off-by: Marco Leise <marco.leise <AT> gmx.de>

 eclass/dlang.eclass | 37 ++++++++++++++++++-------------------
 1 file changed, 18 insertions(+), 19 deletions(-)

diff --git a/eclass/dlang.eclass b/eclass/dlang.eclass
index a8a4ace..80dea3a 100644
--- a/eclass/dlang.eclass
+++ b/eclass/dlang.eclass
@@ -207,25 +207,6 @@ dlang_compile_lib_so() {
 # Makes linker flags meant for GCC understandable for the current D compiler.
 # Basically it replaces -L with what the D compiler uses as linker prefix.
 dlang_convert_ldflags() {
-       if [[ "${DLANG_VENDOR}" == "DigitalMars" ]]; then
-               # gc-sections breaks executables for some versions of D
-               # It works with the gold linker on the other hand
-               # See: https://issues.dlang.org/show_bug.cgi?id=879
-               [[ "${DLANG_PACKAGE_TYPE}" == "dmd" ]] && local 
dlang_version=$SLOT || local dlang_version=$DLANG_VERSION
-               if ver_test $dlang_version -lt 2.072; then
-                       if ! ld -v | grep -q "^GNU gold"; then
-                               filter-ldflags {-L,-Xlinker,-Wl,}--gc-sections
-                       fi
-               fi
-               # Filter ld.gold ICF flag. 
(https://issues.dlang.org/show_bug.cgi?id=17515)
-               filter-ldflags {-L,-Xlinker,-Wl,}--icf={none,all,safe}
-       fi
-
-       if [[ "${DLANG_VENDOR}" == "DigitalMars" ]] || [[ "${DLANG_VENDOR}" == 
"GNU" ]]; then
-               # DMD and GDC don't undestand/work with LTO flags
-               filter-ldflags -f{no-,}use-linker-plugin -f{no-,}lto -flto=*
-       fi
-
        if [[ "${DLANG_VENDOR}" == "DigitalMars" ]] || [[ "${DLANG_VENDOR}" == 
"LDC" ]]; then
                local set prefix flags=()
                if [[ is_dmd ]]; then
@@ -613,6 +594,24 @@ __dlang_use_build_vars() {
                die "Could not detect D compiler vendor!"
        fi
        # We need to convert the LDFLAGS, so they are understood by DMD and LDC.
+       if [[ "${DLANG_VENDOR}" == "DigitalMars" ]]; then
+               # gc-sections breaks executables for some versions of D
+               # It works with the gold linker on the other hand
+               # See: https://issues.dlang.org/show_bug.cgi?id=879
+               [[ "${DLANG_PACKAGE_TYPE}" == "dmd" ]] && local 
dlang_version=$SLOT || local dlang_version=$DLANG_VERSION
+               if ver_test $dlang_version -lt 2.072; then
+                       if ! ld -v | grep -q "^GNU gold"; then
+                               filter-flags {-L,-Xlinker,-Wl\,}--gc-sections
+                       fi
+               fi
+               # Filter ld.gold ICF flag. 
(https://issues.dlang.org/show_bug.cgi?id=17515)
+               filter-flags {-L,-Xlinker,-Wl\,}--icf={none,all,safe}
+       fi
+
+       if [[ "${DLANG_VENDOR}" == "DigitalMars" ]] || [[ "${DLANG_VENDOR}" == 
"GNU" ]]; then
+               # DMD and GDC don't undestand/work with LTO flags
+               filter-ldflags -f{no-,}use-linker-plugin -f{no-,}lto -flto=*
+       fi
        export LDFLAGS=`dlang_convert_ldflags`
        "${@}"
 }

Reply via email to