Message ID | 20200213161614.23246-20-vincenzo.frascino@arm.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Introduce common headers | expand |
On Thu, Feb 13, 2020 at 04:16:14PM +0000, Vincenzo Frascino wrote: > Enable Clang Compilation for the vdso32 library. > > Cc: Catalin Marinas <catalin.marinas@arm.com> > Cc: Will Deacon <will@kernel.org> > Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com> > --- > arch/arm64/kernel/vdso32/Makefile | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile > index 04df57b43cb1..209639101044 100644 > --- a/arch/arm64/kernel/vdso32/Makefile > +++ b/arch/arm64/kernel/vdso32/Makefile > @@ -11,8 +11,10 @@ include $(srctree)/lib/vdso/Makefile > # Same as cc-*option, but using CC_COMPAT instead of CC > ifeq ($(CONFIG_CC_IS_CLANG), y) > CC_COMPAT ?= $(CC) > +LD_COMPAT ?= $(CROSS_COMPILE_COMPAT)gcc Well this is unfortunate :/ It looks like adding the --target flag to VDSO_LDFLAGS allows clang to link the vDSO just fine although it does warn that -nostdinc is unused: clang-11: warning: argument unused during compilation: '-nostdinc' [-Wunused-command-line-argument] It would be nice if the logic of commit fe00e50b2db8 ("ARM: 8858/1: vdso: use $(LD) instead of $(CC) to link VDSO") could be adopted here but I get that this Makefile is its own beast :) at the very least, I think that the --target flag should be added to VDSO_LDFLAGS so that gcc is not a requirement for this but I am curious if you tried that already and noticed any issues with it. Cheers, Nathan > else > CC_COMPAT ?= $(CROSS_COMPILE_COMPAT)gcc > +LD_COMPAT ?= $(CC_COMPAT) > endif > > cc32-option = $(call try-run,\ > @@ -171,7 +173,7 @@ quiet_cmd_vdsold_and_vdso_check = LD32 $@ > cmd_vdsold_and_vdso_check = $(cmd_vdsold); $(cmd_vdso_check) > > quiet_cmd_vdsold = LD32 $@ > - cmd_vdsold = $(CC_COMPAT) -Wp,-MD,$(depfile) $(VDSO_LDFLAGS) \ > + cmd_vdsold = $(LD_COMPAT) -Wp,-MD,$(depfile) $(VDSO_LDFLAGS) \ > -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) -o $@ > quiet_cmd_vdsocc = CC32 $@ > cmd_vdsocc = $(CC_COMPAT) -Wp,-MD,$(depfile) $(VDSO_CFLAGS) -c -o $@ $< > -- > 2.25.0 >
Hi Nathan, On 13/02/2020 18:44, Nathan Chancellor wrote: > On Thu, Feb 13, 2020 at 04:16:14PM +0000, Vincenzo Frascino wrote: >> Enable Clang Compilation for the vdso32 library. [...] >> +LD_COMPAT ?= $(CROSS_COMPILE_COMPAT)gcc > > Well this is unfortunate :/ > > It looks like adding the --target flag to VDSO_LDFLAGS allows > clang to link the vDSO just fine although it does warn that -nostdinc > is unused: > > clang-11: warning: argument unused during compilation: '-nostdinc' > [-Wunused-command-line-argument] > This is why ended up in this "unfortunate" situation :) I wanted to avoid the warning. > It would be nice if the logic of commit fe00e50b2db8 ("ARM: 8858/1: > vdso: use $(LD) instead of $(CC) to link VDSO") could be adopted here > but I get that this Makefile is its own beast :) at the very least, I > think that the --target flag should be added to VDSO_LDFLAGS so that gcc > is not a requirement for this but I am curious if you tried that already > and noticed any issues with it. > --target is my preferred way as well, I can try to play another little bit with the flags and see what I can come up with in the next version. > Cheers, > Nathan [...]
On Mon, Feb 17, 2020 at 12:26:16PM +0000, Vincenzo Frascino wrote: > On 13/02/2020 18:44, Nathan Chancellor wrote: > > On Thu, Feb 13, 2020 at 04:16:14PM +0000, Vincenzo Frascino wrote: > >> Enable Clang Compilation for the vdso32 library. > > [...] > > >> +LD_COMPAT ?= $(CROSS_COMPILE_COMPAT)gcc > > > > Well this is unfortunate :/ > > > > It looks like adding the --target flag to VDSO_LDFLAGS allows > > clang to link the vDSO just fine although it does warn that -nostdinc > > is unused: > > > > clang-11: warning: argument unused during compilation: '-nostdinc' > > [-Wunused-command-line-argument] > > > > This is why ended up in this "unfortunate" situation :) I wanted to avoid the > warning. > > > It would be nice if the logic of commit fe00e50b2db8 ("ARM: 8858/1: > > vdso: use $(LD) instead of $(CC) to link VDSO") could be adopted here > > but I get that this Makefile is its own beast :) at the very least, I > > think that the --target flag should be added to VDSO_LDFLAGS so that gcc > > is not a requirement for this but I am curious if you tried that already > > and noticed any issues with it. > > > > --target is my preferred way as well, I can try to play another little bit with > the flags and see what I can come up with in the next version. Yes, please. I'd even prefer the warning rather than silently assuming that a cross gcc is kicking around on the path. Will
On Mon, 17 Feb 2020 at 17:46, Will Deacon <will@kernel.org> wrote: > > On Mon, Feb 17, 2020 at 12:26:16PM +0000, Vincenzo Frascino wrote: > > On 13/02/2020 18:44, Nathan Chancellor wrote: > > > On Thu, Feb 13, 2020 at 04:16:14PM +0000, Vincenzo Frascino wrote: > > >> Enable Clang Compilation for the vdso32 library. > > > > [...] > > > > >> +LD_COMPAT ?= $(CROSS_COMPILE_COMPAT)gcc > > > > > > Well this is unfortunate :/ > > > > > > It looks like adding the --target flag to VDSO_LDFLAGS allows > > > clang to link the vDSO just fine although it does warn that -nostdinc > > > is unused: > > > > > > clang-11: warning: argument unused during compilation: '-nostdinc' > > > [-Wunused-command-line-argument] > > > > > > > This is why ended up in this "unfortunate" situation :) I wanted to avoid the > > warning. > > > > > It would be nice if the logic of commit fe00e50b2db8 ("ARM: 8858/1: > > > vdso: use $(LD) instead of $(CC) to link VDSO") could be adopted here > > > but I get that this Makefile is its own beast :) at the very least, I > > > think that the --target flag should be added to VDSO_LDFLAGS so that gcc > > > is not a requirement for this but I am curious if you tried that already > > > and noticed any issues with it. > > > > > > > --target is my preferred way as well, I can try to play another little bit with > > the flags and see what I can come up with in the next version. > > Yes, please. I'd even prefer the warning rather than silently assuming that > a cross gcc is kicking around on the path. > Doesn't Clang have -Qunused-arguments for that?
On 17/02/2020 22:39, Ard Biesheuvel wrote: > On Mon, 17 Feb 2020 at 17:46, Will Deacon <will@kernel.org> wrote: >> >> On Mon, Feb 17, 2020 at 12:26:16PM +0000, Vincenzo Frascino wrote: >>> On 13/02/2020 18:44, Nathan Chancellor wrote: >>>> On Thu, Feb 13, 2020 at 04:16:14PM +0000, Vincenzo Frascino wrote: >>>>> Enable Clang Compilation for the vdso32 library. >>> >>> [...] >>> >>>>> +LD_COMPAT ?= $(CROSS_COMPILE_COMPAT)gcc >>>> >>>> Well this is unfortunate :/ >>>> >>>> It looks like adding the --target flag to VDSO_LDFLAGS allows >>>> clang to link the vDSO just fine although it does warn that -nostdinc >>>> is unused: >>>> >>>> clang-11: warning: argument unused during compilation: '-nostdinc' >>>> [-Wunused-command-line-argument] >>>> >>> >>> This is why ended up in this "unfortunate" situation :) I wanted to avoid the >>> warning. >>> >>>> It would be nice if the logic of commit fe00e50b2db8 ("ARM: 8858/1: >>>> vdso: use $(LD) instead of $(CC) to link VDSO") could be adopted here >>>> but I get that this Makefile is its own beast :) at the very least, I >>>> think that the --target flag should be added to VDSO_LDFLAGS so that gcc >>>> is not a requirement for this but I am curious if you tried that already >>>> and noticed any issues with it. >>>> >>> >>> --target is my preferred way as well, I can try to play another little bit with >>> the flags and see what I can come up with in the next version. >> >> Yes, please. I'd even prefer the warning rather than silently assuming that >> a cross gcc is kicking around on the path. >> > > Doesn't Clang have -Qunused-arguments for that? > Yes, this is exactly what I was looking for. Thanks Ard :)
diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile index 04df57b43cb1..209639101044 100644 --- a/arch/arm64/kernel/vdso32/Makefile +++ b/arch/arm64/kernel/vdso32/Makefile @@ -11,8 +11,10 @@ include $(srctree)/lib/vdso/Makefile # Same as cc-*option, but using CC_COMPAT instead of CC ifeq ($(CONFIG_CC_IS_CLANG), y) CC_COMPAT ?= $(CC) +LD_COMPAT ?= $(CROSS_COMPILE_COMPAT)gcc else CC_COMPAT ?= $(CROSS_COMPILE_COMPAT)gcc +LD_COMPAT ?= $(CC_COMPAT) endif cc32-option = $(call try-run,\ @@ -171,7 +173,7 @@ quiet_cmd_vdsold_and_vdso_check = LD32 $@ cmd_vdsold_and_vdso_check = $(cmd_vdsold); $(cmd_vdso_check) quiet_cmd_vdsold = LD32 $@ - cmd_vdsold = $(CC_COMPAT) -Wp,-MD,$(depfile) $(VDSO_LDFLAGS) \ + cmd_vdsold = $(LD_COMPAT) -Wp,-MD,$(depfile) $(VDSO_LDFLAGS) \ -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) -o $@ quiet_cmd_vdsocc = CC32 $@ cmd_vdsocc = $(CC_COMPAT) -Wp,-MD,$(depfile) $(VDSO_CFLAGS) -c -o $@ $<
Enable Clang Compilation for the vdso32 library. Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will@kernel.org> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com> --- arch/arm64/kernel/vdso32/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)