Subject: Re: [RFC] dwarves/pahole: Add test scripts

From: Jiri Olsa <[email-masked]>
Date: Thu, 25 Feb 2021 23:15:55 +0100

On Wed, Feb 24, 2021 at 10:30:45AM -0700, Nathan Chancellor wrote:

SNIP

> > +
> > +build()
> > +{
> > +	local name=$1
> > +	local opts=$2
> 
> A more robust way to handle this might be
> 
> shift
> local opts=$@
> 
> > +
> > +	echo "build ${name} (${OUTPUT}/output)"
> > +
> > +	mkdir -p ${OBJECTS}/${name}
> > +	mkdir -p ${OUTPUT}
> > +
> > +	pushd ${KDIR}
> > +	make ${opts} -j"$(nproc)" O=${OUTPUT} olddefconfig > ${OUTPUT}/output 2>&1
> 
> Then change this to
> 
> make "${opts[@]}"
> 
> shellcheck complains about implicit word splitting (and finds some other
> things in the other script).

I have no doutbs ;-) ok

SNIP

> > +
> > +	PAHOLE=$(realpath ${PAHOLE})
> > +	OBJECTS=$(realpath ${OBJECTS})
> > +
> > +	echo "output:  ${OUTPUT}"
> > +	echo "kdir:    ${KDIR}"
> > +	echo "pahole:  ${PAHOLE}"
> > +	echo "objects: ${OBJECTS}"
> > +	echo
> > +
> > +	mkdir -p ${OBJECTS}
> > +
> > +	echo "cleanup ${KDIR}"
> > +	make -C ${KDIR} mrproper
> > +
> > +
> > +	build x86-clang     "LLVM=1"
> 
> With that change above, you could unquote these options and just pass
> them in as regular parameters.

ok I see, that'd be easier and better looking, I'll change this

> 
> > +	build x86-gcc       ""
> > +
> > +	build aarch64-clang "ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- LLVM=1"
> > +	build aarch64-gcc   "ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-"
> > +
> > +#	build powerpc-clang "ARCH=powerpc CROSS_COMPILE=powerpc64-linux-gnu- LLVM=1"
> > +	build powerpc-gcc   "ARCH=powerpc CROSS_COMPILE=powerpc64-linux-gnu-"
> > +
> > +#	build powerpcle-clang "ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- LLVM=1"
> > +	build powerpcle-gcc   "ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu-"
> > +
> > +#	build s390x-clang   "ARCH=s390 CROSS_COMPILE=s390x-linux-gnu- LLVM=1"
> 
> powerpc64le and s390 can build with CC=clang, instead of LLVM=1.

I got some strange error when building ppc and s390 with LLVM=1,
but I did not check it deeply.. I'll try with CC=clang then, great

> 
> I will see if I can give this a run locally over the next week or so.

thanks,
jirka