linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: drop support for cc-ldoption
@ 2019-04-23 21:27 Nick Desaulniers
  2019-04-24  3:51 ` Masahiro Yamada
  2019-05-20 15:08 ` Masahiro Yamada
  0 siblings, 2 replies; 3+ messages in thread
From: Nick Desaulniers @ 2019-04-23 21:27 UTC (permalink / raw)
  To: yamada.masahiro, michal.lkml, corbet
  Cc: Nick Desaulniers, clang-built-linux, linux-kbuild, linux-doc,
	linux-kernel

If you want to see if your linker supports a certain flag, then ask the
linker directly with ld-option (not the compiler with cc-ldoption).
Checking for linker flag support is an antipattern that complicates the
usage of various linkers other than bfd via -fuse-ld={bfd|gold|lld}.

Cc: clang-built-linux@googlegroups.com
Suggested-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
This should probably wait until all of the call sites have been cleaned
up. Masahiro sent them for arm and arm64, while I sent cleanups for all
the rest.


 Documentation/kbuild/makefiles.txt | 14 --------------
 scripts/Kbuild.include             |  5 -----
 2 files changed, 19 deletions(-)

diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
index 03c065855eaf..d65ad5746f94 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -437,20 +437,6 @@ more details, with real examples.
 	The second argument is optional, and if supplied will be used
 	if first argument is not supported.
 
-    cc-ldoption
-	cc-ldoption is used to check if $(CC) when used to link object files
-	supports the given option.  An optional second option may be
-	specified if first option are not supported.
-
-	Example:
-		#arch/x86/kernel/Makefile
-		vsyscall-flags += $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
-
-	In the above example, vsyscall-flags will be assigned the option
-	-Wl$(comma)--hash-style=sysv if it is supported by $(CC).
-	The second argument is optional, and if supplied will be used
-	if first argument is not supported.
-
     as-instr
 	as-instr checks if the assembler reports a specific instruction
 	and then outputs either option1 or option2
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 7484b9d8272f..fbfb37d1bcc8 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -138,11 +138,6 @@ cc-disable-warning = $(call try-run,\
 # Usage:  EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
 cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || echo $(4))
 
-# cc-ldoption
-# Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both)
-cc-ldoption = $(call try-run,\
-	$(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
-
 # ld-option
 # Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
 ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))
-- 
2.21.0.593.g511ec345e18-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kbuild: drop support for cc-ldoption
  2019-04-23 21:27 [PATCH] kbuild: drop support for cc-ldoption Nick Desaulniers
@ 2019-04-24  3:51 ` Masahiro Yamada
  2019-05-20 15:08 ` Masahiro Yamada
  1 sibling, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2019-04-24  3:51 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Michal Marek, Jonathan Corbet, clang-built-linux,
	Linux Kbuild mailing list, open list:DOCUMENTATION,
	Linux Kernel Mailing List

On Wed, Apr 24, 2019 at 6:27 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> If you want to see if your linker supports a certain flag, then ask the
> linker directly with ld-option (not the compiler with cc-ldoption).
> Checking for linker flag support is an antipattern that complicates the
> usage of various linkers other than bfd via -fuse-ld={bfd|gold|lld}.
>
> Cc: clang-built-linux@googlegroups.com
> Suggested-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
> This should probably wait until all of the call sites have been cleaned
> up.

Indeed.
Please remind me if I forget to apply this.


> Masahiro sent them for arm and arm64, while I sent cleanups for all
> the rest.

Thanks. I did not even notice cc-ldoption were checking
quite old flags.




>
>
>  Documentation/kbuild/makefiles.txt | 14 --------------
>  scripts/Kbuild.include             |  5 -----
>  2 files changed, 19 deletions(-)
>
> diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
> index 03c065855eaf..d65ad5746f94 100644
> --- a/Documentation/kbuild/makefiles.txt
> +++ b/Documentation/kbuild/makefiles.txt
> @@ -437,20 +437,6 @@ more details, with real examples.
>         The second argument is optional, and if supplied will be used
>         if first argument is not supported.
>
> -    cc-ldoption
> -       cc-ldoption is used to check if $(CC) when used to link object files
> -       supports the given option.  An optional second option may be
> -       specified if first option are not supported.
> -
> -       Example:
> -               #arch/x86/kernel/Makefile
> -               vsyscall-flags += $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
> -
> -       In the above example, vsyscall-flags will be assigned the option
> -       -Wl$(comma)--hash-style=sysv if it is supported by $(CC).
> -       The second argument is optional, and if supplied will be used
> -       if first argument is not supported.
> -
>      as-instr
>         as-instr checks if the assembler reports a specific instruction
>         and then outputs either option1 or option2
> diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
> index 7484b9d8272f..fbfb37d1bcc8 100644
> --- a/scripts/Kbuild.include
> +++ b/scripts/Kbuild.include
> @@ -138,11 +138,6 @@ cc-disable-warning = $(call try-run,\
>  # Usage:  EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
>  cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || echo $(4))
>
> -# cc-ldoption
> -# Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both)
> -cc-ldoption = $(call try-run,\
> -       $(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
> -
>  # ld-option
>  # Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
>  ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))
> --
> 2.21.0.593.g511ec345e18-goog
>


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kbuild: drop support for cc-ldoption
  2019-04-23 21:27 [PATCH] kbuild: drop support for cc-ldoption Nick Desaulniers
  2019-04-24  3:51 ` Masahiro Yamada
@ 2019-05-20 15:08 ` Masahiro Yamada
  1 sibling, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2019-05-20 15:08 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Michal Marek, Jonathan Corbet, clang-built-linux,
	Linux Kbuild mailing list, open list:DOCUMENTATION,
	Linux Kernel Mailing List

On Wed, Apr 24, 2019 at 6:27 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> If you want to see if your linker supports a certain flag, then ask the
> linker directly with ld-option (not the compiler with cc-ldoption).
> Checking for linker flag support is an antipattern that complicates the
> usage of various linkers other than bfd via -fuse-ld={bfd|gold|lld}.
>
> Cc: clang-built-linux@googlegroups.com
> Suggested-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---

Applied to linux-kbuild. Thanks.




> This should probably wait until all of the call sites have been cleaned
> up. Masahiro sent them for arm and arm64, while I sent cleanups for all
> the rest.
>
>
>  Documentation/kbuild/makefiles.txt | 14 --------------
>  scripts/Kbuild.include             |  5 -----
>  2 files changed, 19 deletions(-)
>
> diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
> index 03c065855eaf..d65ad5746f94 100644
> --- a/Documentation/kbuild/makefiles.txt
> +++ b/Documentation/kbuild/makefiles.txt
> @@ -437,20 +437,6 @@ more details, with real examples.
>         The second argument is optional, and if supplied will be used
>         if first argument is not supported.
>
> -    cc-ldoption
> -       cc-ldoption is used to check if $(CC) when used to link object files
> -       supports the given option.  An optional second option may be
> -       specified if first option are not supported.
> -
> -       Example:
> -               #arch/x86/kernel/Makefile
> -               vsyscall-flags += $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
> -
> -       In the above example, vsyscall-flags will be assigned the option
> -       -Wl$(comma)--hash-style=sysv if it is supported by $(CC).
> -       The second argument is optional, and if supplied will be used
> -       if first argument is not supported.
> -
>      as-instr
>         as-instr checks if the assembler reports a specific instruction
>         and then outputs either option1 or option2
> diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
> index 7484b9d8272f..fbfb37d1bcc8 100644
> --- a/scripts/Kbuild.include
> +++ b/scripts/Kbuild.include
> @@ -138,11 +138,6 @@ cc-disable-warning = $(call try-run,\
>  # Usage:  EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
>  cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || echo $(4))
>
> -# cc-ldoption
> -# Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both)
> -cc-ldoption = $(call try-run,\
> -       $(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
> -
>  # ld-option
>  # Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
>  ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))
> --
> 2.21.0.593.g511ec345e18-goog
>


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-20 15:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-23 21:27 [PATCH] kbuild: drop support for cc-ldoption Nick Desaulniers
2019-04-24  3:51 ` Masahiro Yamada
2019-05-20 15:08 ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).