aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Leise <marco.leise@gmx.de>2020-08-14 21:59:19 +0200
committerMarco Leise <marco.leise@gmx.de>2020-08-15 03:34:45 +0200
commitbe92bd625289f6c2167917761dd4690cc62986d0 (patch)
tree382892e402185ad0261eae6e91889c5f10b371af
parentMoved remaining ldc2 ebuilds to EAPI=7 and all of them from the legacy eclass... (diff)
downloaddlang-be92bd625289f6c2167917761dd4690cc62986d0.tar.gz
dlang-be92bd625289f6c2167917761dd4690cc62986d0.tar.bz2
dlang-be92bd625289f6c2167917761dd4690cc62986d0.zip
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@gmx.de>
-rw-r--r--eclass/dlang.eclass37
1 files 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`
"${@}"
}