lkml.org 
[lkml]   [2017]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 1/7] kbuild: add ld-name macro and support for GNU gold
On Wed, Nov 29, 2017 at 3:44 PM, Sami Tolvanen <samitolvanen@google.com> 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.

\
 
 \ /
  Last update: 2017-11-30 01:33    [W:0.161 / U:3.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site