[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH v1 2/4] automation: add cross-compiler support for the build script



On Thu, 2022-12-29 at 10:13 +0200, Oleksii wrote:
> On Wed, 2022-12-28 at 23:24 +0000, Andrew Cooper wrote:
> > On 23/12/2022 11:16 am, Oleksii Kurochko wrote:
> > > diff --git a/automation/scripts/build b/automation/scripts/build
> > > index a593419063..026f480e76 100755
> > > --- a/automation/scripts/build
> > > +++ b/automation/scripts/build
> > > @@ -2,12 +2,12 @@
> > >  
> > >  test -f /etc/os-release && cat "$_"
> > >  
> > > -$CC --version
> > > +${CROSS_COMPILE}${CC} --version
> > >  
> > >  # Express the compiler version as an integer.  e.g. GCC 4.9.2 =>
> > > 0x040902
> > >  cc-ver()
> > >  {
> > > -    $CC -dumpversion | awk -F. '{ printf "0x%02x%02x%02x", $1,
> > > $2,
> > > $3 }'
> > > +    ${CROSS_COMPILE}${CC} -dumpversion | awk -F. '{ printf
> > > "0x%02x%02x%02x", $1, $2, $3 }'
> > >  }
> > >  
> > >  # random config or default config
> > > @@ -66,7 +66,7 @@ if ! type python3 || python3 -c "import sys;
> > > res
> > > = sys.version_info < (3, 5); ex
> > >  fi
> > >  
> > >  # SeaBIOS requires GCC 4.6 or later
> > > -if [[ "${CC}" == "gcc" && `cc-ver` -lt 0x040600 ]]; then
> > > +if [[ "${CROSS_COMPILE}${CC}" == "gcc" && `cc-ver` -lt 0x040600
> > > ]]; then
> > 
> > This change won't work, because it's no longer a plain "gcc".
> > 
> 
> If look at tests on GitLab CI&CD these changes don't break anything.
> 
> > Also, prepreding CROSS_COMPILE isn't compatible with LLVM
> > toolchains,
> > but that's not something you've made any worse with your change
> > (just
> > more obvious).
> > 
> 
> CROSS_COMPILE isn't use with LLVM toolchain. I mean that in case of
> LLVM toolchain CROSS_COMPILE would be equal to empty string plus
> CC=clang or something similar.
> 
> > We probably want a stanza near the top which sets
> > CC="${CROSS_COMPILE}${CC}" which can be adjusted to support LLVM in
> > due
> > course, and we'll need to detect GCC using --version | grep as its
> > done
> > elsewhere.
> > 
> > But the other logic wants reworking too so we don't play around
> > with
> > bits of the tools build when we're doing a hypervisor-only build
> > anyway...
> > 
> 
> I think that I can get rid of CROSS_COMPILE variable at all and use
> CC=riscv64-linux-gnu-gcc direcly for RISC-V 64 targers in build.yaml.
> Would this be a better solution?
> 
It will not work.
At least that CROSS_COMPILE variable is set in riscv64.dockerfile.
So it will definitely mess the hypervisor build.
> > ~Andrew
> 
> ~Oleksii
> 




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.