Thread (28 messages) 28 messages, 4 authors, 2017-12-01

[PATCH 1/7] kbuild: add ld-name macro and support for GNU gold

From: ndesaulniers@google.com (Nick Desaulniers)
Date: 2017-11-30 00:32:57
Also in: linux-kbuild, lkml

On Wed, Nov 29, 2017 at 3:44 PM, Sami Tolvanen [off-list ref] wrote:
GNU gold may require different flags than GNU ld. Add a macro for
detecting the linker and conditionally add gold specific flags from
LDFLAGS_GOLD.
Right, but you're still only ever using one linker per build, correct?
 Can we get away without 2 distinct flags?
+# Add any flags specific to ld.gold
+ifeq ($(ld-name),gold)
+LDFLAGS                += $(LDFLAGS_GOLD)
+endif
+
Patch 1 and 6 have this pattern of always assigning to LDFLAGS_GOLD,
then that to LDFLAGS.  Wouldn't it be better to check the ld-name and
conditionally assign to LDFLAGS? Then LDFLAGS_GOLD is not necessary.
For example, what I'm suggesting is what is done in patch 4.
+# ld-name
+# Expands to either bfd or gold
+ld-name = $(shell $(LD) -v 2>&1 | grep -q "GNU gold" && echo gold || echo bfd)
+
This part LGTM.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help