|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 1/5] make: simplify setting HOST{CC/CXX}
On Fri, Jun 28, 2019 at 10:40:02AM +0000, Jan Beulich wrote:
> On 28.06.2019 12:15, Roger Pau Monné wrote:
> > On Fri, Jun 28, 2019 at 09:29:53AM +0000, Jan Beulich wrote:
> >> >>> On 26.06.19 at 15:55, <roger.pau@xxxxxxxxxx> wrote:
> > TBH I would like some guidelines about how CROSS_COMPILE is supposed
> > to be used.
>
> It never having been spelled out, I guess it's down to the various flavors
> people might be using. For me personally CROSS_COMPILE isn't flexible
> enough anyway, so I have to further alter it in a local patch I carry (to
> accommodate for suffixes on the command names alongside prefixes).
>
> > I agree the above is not very nice when CROSS_COMPILE is set. What
> > about something like:
> >
> > ifeq ($(clang),y)
> > CC ?= clang
> > CXX ?= clang++
> > LD_LTO ?= llvm-ld
> > HOSTCC ?= $(CC)
> > HOSTCXX ?= $(CXX)
> > CC = $(CROSS_COMPILE)$(CC)
> > CXX = $(CROSS_COMPILE)$(CXX)
> > LD_LTO = $(CROSS_COMPILE)$(LD_LTO)
> > else
> > [...]
> >
> > That would keep the current behaviour of setting CC=gcc
> > CROSS_COMPILE=arm-linux-gnueabi-, which my previous approach didn't.
>
> Hmm, yes, this might work for many cases. (The CC/CXX/LD_LTO lines then
> wouldn't need to be inside the ifeq() anymore, though.)
Oh, right.
> However, consider this invocation, which I use for pre-push build checks
> on a 32-bit host:
>
> make -sC build/xen/$v {XEN_TARGET_ARCH,t}=x86_64 CC=gccx LD=ldx
> OBJCOPY=objcopyx NM=nmx -j32 xen
>
> The "t" environment variable is used by gccx (which is a shell script).
> That same shell script would then get invoked for uses of $(HOSTCC),
> and wrongly try to build a 64-bit object/binary. I'm afraid it is wrong
> in general to derive HOSTCC from CC.
OK, so then we should just set HOST{CC/CXX} to clang/gcc if unset,
like we do for CC/CXX. I think this would be fine for your use case.
Note that currently HOST{CC/CXX} is derived from CC/CXX if
XEN_COMPILE_ARCH matches XEN_TARGET_ARCH (see Config.mk):
# If we are not cross-compiling, default HOSTC{C/XX} to C{C/XX}
ifeq ($(XEN_TARGET_ARCH), $(XEN_COMPILE_ARCH))
HOSTCC ?= $(CC)
HOSTCXX ?= $(CXX)
endif
So what about:
ifeq ($(clang),y)
DEF_CC = clang
DEF_CXX = clang++
DEF_LD_LTO = llvm-ld
else
DEF_CC = gcc
DEF_CXX = g++
DEF_LD_LTO = ld
endif
ifeq ($(XEN_TARGET_ARCH), $(XEN_COMPILE_ARCH))
HOSTCC ?= $(DEF_CC)
HOSTCXX ?= $(DEF_CXX)
endif
CC ?= $(DEF_CC)
CXX ?= $(DEF_CXX)
LD_LTO ?= $(DEF_LD_LTO)
CC = $(CROSS_COMPILE)$(CC)
CXX = $(CROSS_COMPILE)$(CXX)
LD_LTO = $(CROSS_COMPILE)$(LD_LTO)
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |