build: nmk -- Filter out -Wl flags from linking builtin targets

Submitted by Cyrill Gorcunov on June 30, 2016, 3:46 p.m.

Details

Message ID 1467301561-13783-1-git-send-email-gorcunov@openvz.org
State Accepted
Series "build: nmk -- Filter out -Wl flags from linking builtin targets"
Commit 1a149d829e5bec3dca515ac9567d396803c26ebc
Headers show

Commit Message

Cyrill Gorcunov June 30, 2016, 3:46 p.m.
Tycho reported that Debian uses custom LDFLAGS to
build criu, this flag get propagated into built-in
targets where we use $(LD) instead causing build
procedure to interrupt

|  LINK     arch/x86/syscalls.built-in.o
| ld: unrecognized option '-Wl,-Bsymbolic-functions'
| ld: use the --help option for usage information
| /«PKGBUILDDIR»/scripts/nmk/scripts/build.mk:141: recipe for target 'arch/x86/syscalls.built-in.o' failed

Lets make maintainers life easier and filter
out the flags we know never accepted by $(LD).

Reported-by: Tycho Andersen <tycho.andersen@canonical.com>
Tested-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 scripts/nmk/scripts/build.mk | 9 +++++++++
 1 file changed, 9 insertions(+)

Patch hide | download patch | download mbox

diff --git a/scripts/nmk/scripts/build.mk b/scripts/nmk/scripts/build.mk
index bd409441293e..87da2d97aee4 100644
--- a/scripts/nmk/scripts/build.mk
+++ b/scripts/nmk/scripts/build.mk
@@ -25,6 +25,15 @@  ifndef obj
 endif
 
 #
+# Filter out any -Wl,XXX option: some of build farms
+# assumes that we're using $(CC) for building built-in
+# targets (and they have all rights to). But we're
+# using $(LD) directly instead so filter out -Wl
+# flags to make maintainer's life easier.
+LDFLAGS-MASK	:= -Wl,%
+LDFLAGS		:= $(filter-out $(LDFLAGS-MASK),$(LDFLAGS))
+
+#
 # Accumulate common flags.
 define nmk-ccflags
         $(CFLAGS) $(ccflags-y) $(CFLAGS_$(@F))

Comments

Dmitry Safonov July 1, 2016, 11:05 a.m.
On 06/30/2016 06:46 PM, Cyrill Gorcunov wrote:
> Tycho reported that Debian uses custom LDFLAGS to
> build criu, this flag get propagated into built-in
> targets where we use $(LD) instead causing build
> procedure to interrupt
>
> |  LINK     arch/x86/syscalls.built-in.o
> | ld: unrecognized option '-Wl,-Bsymbolic-functions'
> | ld: use the --help option for usage information
> | /«PKGBUILDDIR»/scripts/nmk/scripts/build.mk:141: recipe for target 'arch/x86/syscalls.built-in.o' failed
>
> Lets make maintainers life easier and filter
> out the flags we know never accepted by $(LD).
>
> Reported-by: Tycho Andersen <tycho.andersen@canonical.com>
> Tested-by: Tycho Andersen <tycho.andersen@canonical.com>
> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>

Should we pass those parameters to ld without -Wl, or silently ignore
them like in this patch?
Maybe ignore for simplicity for now. Anyway, anyone who want override
LDFLAGS may pass them without -Wl, so they wouldn't be filtered.

Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>

> ---
>  scripts/nmk/scripts/build.mk | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/scripts/nmk/scripts/build.mk b/scripts/nmk/scripts/build.mk
> index bd409441293e..87da2d97aee4 100644
> --- a/scripts/nmk/scripts/build.mk
> +++ b/scripts/nmk/scripts/build.mk
> @@ -25,6 +25,15 @@ ifndef obj
>  endif
>
>  #
> +# Filter out any -Wl,XXX option: some of build farms
> +# assumes that we're using $(CC) for building built-in
> +# targets (and they have all rights to). But we're
> +# using $(LD) directly instead so filter out -Wl
> +# flags to make maintainer's life easier.
> +LDFLAGS-MASK	:= -Wl,%
> +LDFLAGS		:= $(filter-out $(LDFLAGS-MASK),$(LDFLAGS))
> +
> +#
>  # Accumulate common flags.
>  define nmk-ccflags
>          $(CFLAGS) $(ccflags-y) $(CFLAGS_$(@F))
>
Cyrill Gorcunov July 1, 2016, 11:10 a.m.
On Fri, Jul 01, 2016 at 02:05:37PM +0300, Dmitry Safonov wrote:
> On 06/30/2016 06:46 PM, Cyrill Gorcunov wrote:
> > Tycho reported that Debian uses custom LDFLAGS to
> > build criu, this flag get propagated into built-in
> > targets where we use $(LD) instead causing build
> > procedure to interrupt
> > 
> > |  LINK     arch/x86/syscalls.built-in.o
> > | ld: unrecognized option '-Wl,-Bsymbolic-functions'
> > | ld: use the --help option for usage information
> > | /«PKGBUILDDIR»/scripts/nmk/scripts/build.mk:141: recipe for target 'arch/x86/syscalls.built-in.o' failed
> > 
> > Lets make maintainers life easier and filter
> > out the flags we know never accepted by $(LD).
> > 
> > Reported-by: Tycho Andersen <tycho.andersen@canonical.com>
> > Tested-by: Tycho Andersen <tycho.andersen@canonical.com>
> > Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
> 
> Should we pass those parameters to ld without -Wl, or silently ignore
> them like in this patch?
> Maybe ignore for simplicity for now. Anyway, anyone who want override
> LDFLAGS may pass them without -Wl, so they wouldn't be filtered.
> 
> Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>

I think we better ignore, criu is special, and using nmk
implies that if you need some parameters for builtin
targets -- use ldflags-y.
Dmitry Safonov July 1, 2016, 11:15 a.m.
On 07/01/2016 02:10 PM, Cyrill Gorcunov wrote:
> On Fri, Jul 01, 2016 at 02:05:37PM +0300, Dmitry Safonov wrote:
>> On 06/30/2016 06:46 PM, Cyrill Gorcunov wrote:
>>> Tycho reported that Debian uses custom LDFLAGS to
>>> build criu, this flag get propagated into built-in
>>> targets where we use $(LD) instead causing build
>>> procedure to interrupt
>>>
>>> |  LINK     arch/x86/syscalls.built-in.o
>>> | ld: unrecognized option '-Wl,-Bsymbolic-functions'
>>> | ld: use the --help option for usage information
>>> | /«PKGBUILDDIR»/scripts/nmk/scripts/build.mk:141: recipe for target 'arch/x86/syscalls.built-in.o' failed
>>>
>>> Lets make maintainers life easier and filter
>>> out the flags we know never accepted by $(LD).
>>>
>>> Reported-by: Tycho Andersen <tycho.andersen@canonical.com>
>>> Tested-by: Tycho Andersen <tycho.andersen@canonical.com>
>>> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
>>
>> Should we pass those parameters to ld without -Wl, or silently ignore
>> them like in this patch?
>> Maybe ignore for simplicity for now. Anyway, anyone who want override
>> LDFLAGS may pass them without -Wl, so they wouldn't be filtered.
>>
>> Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
>
> I think we better ignore, criu is special, and using nmk
> implies that if you need some parameters for builtin
> targets -- use ldflags-y.
>

Well, I also think so.
Pavel Emelianov July 4, 2016, 6:12 p.m.
Applied