* [gentoo-dev] [PATCH] flag-o-matic.eclass: Strip LDFLAGS unsupported by the C compiler, #621274
@ 2017-07-01 16:22 Michał Górny
2017-08-08 19:42 ` Michał Górny
0 siblings, 1 reply; 2+ messages in thread
From: Michał Górny @ 2017-07-01 16:22 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Include LDFLAGS in the variables stripped by strip-unsupported-flags.
The code reuses the current functions for testing CC, and so only remove
LDFLAGS that are rejected by the C compiler and not the linker. This
solves the case of bug #621274 where LDFLAGS contained GCC-specific
-flto flag.
---
eclass/flag-o-matic.eclass | 3 +++
eclass/tests/flag-o-matic.sh | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index b2f3742b3ecf..4ef32c519f22 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -535,6 +535,9 @@ strip-unsupported-flags() {
export CXXFLAGS=$(test-flags-CXX ${CXXFLAGS})
export FFLAGS=$(test-flags-F77 ${FFLAGS})
export FCFLAGS=$(test-flags-FC ${FCFLAGS})
+ # note: this does not verify the linker flags but it is enough
+ # to strip invalid C flags which are much more likely, #621274
+ export LDFLAGS=$(test-flags-CC ${LDFLAGS})
}
# @FUNCTION: get-flag
diff --git a/eclass/tests/flag-o-matic.sh b/eclass/tests/flag-o-matic.sh
index 92c68b82c3c9..24f2a4c4af4e 100755
--- a/eclass/tests/flag-o-matic.sh
+++ b/eclass/tests/flag-o-matic.sh
@@ -55,7 +55,7 @@ done <<<"
tbegin "strip-unsupported-flags"
strip-unsupported-flags
-[[ ${CFLAGS} == "" ]] && [[ ${CXXFLAGS} == "-z=2" ]]
+[[ ${CFLAGS} == "" ]] && [[ ${CXXFLAGS} == "-z=2" ]] && [[ ${LDFLAGS} == "" ]]
ftend
for var in $(all-flag-vars) ; do
--
2.13.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [gentoo-dev] [PATCH] flag-o-matic.eclass: Strip LDFLAGS unsupported by the C compiler, #621274
2017-07-01 16:22 [gentoo-dev] [PATCH] flag-o-matic.eclass: Strip LDFLAGS unsupported by the C compiler, #621274 Michał Górny
@ 2017-08-08 19:42 ` Michał Górny
0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2017-08-08 19:42 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 558 bytes --]
On sob, 2017-07-01 at 18:22 +0200, Michał Górny wrote:
> Include LDFLAGS in the variables stripped by strip-unsupported-flags.
> The code reuses the current functions for testing CC, and so only remove
> LDFLAGS that are rejected by the C compiler and not the linker. This
> solves the case of bug #621274 where LDFLAGS contained GCC-specific
> -flto flag.
> ---
> eclass/flag-o-matic.eclass | 3 +++
> eclass/tests/flag-o-matic.sh | 2 +-
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
Merged.
--
Best regards,
Michał Górny
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 988 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-08-08 19:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-01 16:22 [gentoo-dev] [PATCH] flag-o-matic.eclass: Strip LDFLAGS unsupported by the C compiler, #621274 Michał Górny
2017-08-08 19:42 ` Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox