lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
 <PAXPR04MB845918523309488B79BB617A882A2@PAXPR04MB8459.eurprd04.prod.outlook.com>
Date: Fri, 29 Nov 2024 00:38:45 +0000
From: Peng Fan <peng.fan@....com>
To: Florian Fainelli <florian.fainelli@...adcom.com>, "Peng Fan (OSS)"
	<peng.fan@....nxp.com>, Thomas Renninger <trenn@...e.com>, Shuah Khan
	<shuah@...nel.org>, "John B. Wyatt IV" <jwyatt@...hat.com>, John Kacur
	<jkacur@...hat.com>
CC: "linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2 2/2] pm: cpupower: Makefile: Allow overriding
 cross-compiling env params

> Subject: Re: [PATCH v2 2/2] pm: cpupower: Makefile: Allow overriding
> cross-compiling env params
> 
> On 11/21/24 16:13, Peng Fan wrote:
> >> Subject: Re: [PATCH v2 2/2] pm: cpupower: Makefile: Allow
> overriding
> >> cross-compiling env params
> >>
> >> On 11/21/24 04:40, Peng Fan wrote:
> >>>> Subject: Re: [PATCH v2 2/2] pm: cpupower: Makefile: Allow
> >> overriding
> >>>> cross-compiling env params
> >>>>
> >>>> Hi Peng,
> >>>>
> >>>> On 9/19/2024 5:08 AM, Peng Fan (OSS) wrote:
> >>>>> From: Peng Fan <peng.fan@....com>
> >>>>>
> >>>>> Allow overriding the cross-comple env parameters to make it
> >> easier
> >>>> for
> >>>>> Yocto users. Then cross-compiler toolchains to build cpupower
> >> with
> >>>>> only two steps:
> >>>>> - source (toolchain path)/environment-setup-armv8a-poky-linux
> >>>>> - make
> >>>>
> >>>> This patch breaks the way that buildroot builds cpupower:
> >>>>
> >>>>
> >>
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2F
> >>>> git.buildroot.net%2Fbuildroot%2Ftree%2Fpackage%2Flinux-
> >>>> tools%2Flinux-tool-
> >>>>
> >>
> cpupower.mk.in&data=05%7C02%7Cpeng.fan%40nxp.com%7C246da9
> >>>>
> >>
> 2d8b6243d138c808dd09e6d644%7C686ea1d3bc2b4c6fa92cd99c5c3
> >>>>
> >>
> 01635%7C0%7C0%7C638677609234547728%7CUnknown%7CTWFpb
> >>>>
> >>
> GZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJX
> >>>>
> >>
> aW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdat
> >>>>
> >>
> a=nL1YUl%2F07Vd8F0GpW7uRqdpZT74avOku1ox9N3%2FFkUg%3D&r
> >>>> eserved=0
> >>>>
> >>>> and after enabling verbose it becomes clear as to why, see below:
> >>>>
> >>>>    >>> linux-tools  Configuring
> >>>>    >>> linux-tools  Building
> >>>> GIT_DIR=.
> >>>> PATH="/local/users/fainelli/buildroot-
> >>>> upstream/output/arm/host/bin:/local/users/fainelli/buildroot-
> >>>>
> >>
> upstream/output/arm/host/sbin:/projects/firepath/tools/bin:/home/ff
> >>>>
> >>
> 944844/bin:/home/ff944844/.local/bin:/opt/stblinux/bin:/usr/local/sb
> >>>> in:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/loc
> >>>> al /ga mes:/snap/bin:/opt/toolchains/metaware-vctools-
> 0.4.1/bin/"
> >>>> /usr/bin/make -j97
> >>>> CROSS=/local/users/fainelli/buildroot-
> >>>> upstream/output/arm/host/bin/arm-linux-
> >>>> CPUFREQ_BENCH=false NLS=false LDFLAGS="-L.
> >>>> -L/local/users/fainelli/buildroot-
> >> upstream/output/arm/target/usr/lib"
> >>>> DEBUG=false V=1 -C
> >>>> /local/users/fainelli/buildroot-upstream/output/arm/build/linux-
> >>>> custom/tools
> >>>> cpupower
> >>>> mkdir -p power/cpupower && /usr/bin/make
> >> subdir=power/cpupower
> >>>> --no-print-directory -C power/cpupower cc -DVERSION=\"6.12.0\"
> -
> >>>> DPACKAGE=\"cpupower\"
> >>>> -DPACKAGE_BUGREPORT=\"linux-pm@...r.kernel.org\" -
> >> D_GNU_SOURCE -pipe
> >>>> -Wall -Wchar-subscripts -Wpointer-arith -Wsign- compare
> >>>> -Wno-pointer-sign -Wdeclaration-after-statement -Wshadow - Os
> >>>> -fomit-frame-pointer -fPIC -o lib/cpufreq.o -c lib/cpufreq.c
> >>>
> >>> You are building on an ARM host? Or you are cross compiling with
> cc
> >> is
> >>> actually arm gcc?
> >>
> >> This is cross compiling targeting ARM, which is why CROSS is set to
> >> ../arm-linux-
> >>
> >>>
> >>>>
> >>>> Here we use cc, aka host compiler, rather than $(CROSS)gcc as we
> >>>> should, so we are no longer cross compiling at all.
> >>>
> >>> I not understand. CROSS was set, but using cc to compile for host?
> >>
> >> See below.
> >>
> >>>
> >>>>
> >>>> The issue is the use of the lazy set if absent for *all* of CC, LD,
> >>>> AR, STRIP, RANLIB, rather than just for CROSS. The following fixes
> >>>> it
> >> for me:
> >>>>
> >>>> diff --git a/tools/power/cpupower/Makefile
> >>>> b/tools/power/cpupower/Makefile index
> >>>> 175004ce44b2..96bb1e5f3970 100644
> >>>> --- a/tools/power/cpupower/Makefile
> >>>> +++ b/tools/power/cpupower/Makefile
> >>>> @@ -87,11 +87,11 @@ INSTALL_SCRIPT = ${INSTALL} -m 644
> >>>>     # to something more interesting, like "arm-linux-".  If you want
> >>>>     # to compile vs uClibc, that can be done here as well.
> >>>>     CROSS ?= #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
> >>>> -CC ?= $(CROSS)gcc
> >>>> -LD ?= $(CROSS)gcc
> >>>> -AR ?= $(CROSS)ar
> >>>> -STRIP ?= $(CROSS)strip
> >>>> -RANLIB ?= $(CROSS)ranlib
> >>>> +CC = $(CROSS)gcc
> >>>> +LD = $(CROSS)gcc
> >>>> +AR = $(CROSS)ar
> >>>> +STRIP = $(CROSS)strip
> >>>> +RANLIB = $(CROSS)ranlib
> >>>
> >>> The ? is just allow to override CC/LD/AR.., so in your env, CC is
> >>> set, but should not be used for cpupower compling?
> >>
> >> Adding debug to show the origin of the CC variable shows the
> following:
> >>
> >> CROSS=/local/users/fainelli/buildroot-
> >> upstream/output/arm/host/bin/arm-linux-
> >> CC origin is (default) and value is (cc) LD origin is (default) and
> >> value is
> >> (ld) CC=cc LD=ld AR=ar STRIP= RANLIB=
> >
> >
> > How about
> > CROSS ?= #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
> > ifneq ($(CROSS), )
> > CC = $(CROSS)gcc
> > LD = $(CROSS)gcc
> > AR = $(CROSS)ar
> > STRIP = $(CROSS)strip
> > RANLIB = $(CROSS)ranlib
> > else
> > CC ?= $(CROSS)gcc
> > LD ?= $(CROSS)gcc
> > AR ?= $(CROSS)ar
> > STRIP ?= $(CROSS)strip
> > RANLIB ?= $(CROSS)ranlib
> > Endif
> 
> Yes, this works just as well, do you want to submit this if that works in
> your environment as well?

I will prepare a patch.

Thanks,
Peng.

> --
> Florian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ