diff mbox series

tools build: Provide consistent build options for fixdep

Message ID 20240814173021.3726785-1-agordeev@linux.ibm.com (mailing list archive)
State New
Headers show
Series tools build: Provide consistent build options for fixdep | expand

Commit Message

Alexander Gordeev Aug. 14, 2024, 5:30 p.m. UTC
The fixdep binary is being compiled and linked in one step since commit
ea974028a049 ("tools build: Avoid circular .fixdep-in.o.cmd issues").
While the host linker flags are passed to the compiler the host compiler
flags are missed.

That might lead to failures as result of the compiler vs linker flags
inconsistency. For example, during RPM package build redhat-hardened-ld
script is provided to gcc, while redhat-hardened-cc1 script is missed.
That leads to an error on s390:

/usr/bin/ld: /tmp/ccUT8Rdm.o: `stderr@@GLIBC_2.2' non-PLT reloc for
symbol defined in shared library and accessed from executable (rebuild
file with -fPIC ?)

Provide both KBUILD_HOSTCFLAGS and KBUILD_HOSTLDFLAGS to avoid that.

Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
---

This patch is against kernel-next next-20240814 tag

---
 tools/build/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Brian Norris Aug. 14, 2024, 5:35 p.m. UTC | #1
Hi,

On Wed, Aug 14, 2024 at 10:30 AM Alexander Gordeev
<agordeev@linux.ibm.com> wrote:
>
> The fixdep binary is being compiled and linked in one step since commit
> ea974028a049 ("tools build: Avoid circular .fixdep-in.o.cmd issues").
> While the host linker flags are passed to the compiler the host compiler
> flags are missed.
>
> That might lead to failures as result of the compiler vs linker flags
> inconsistency. For example, during RPM package build redhat-hardened-ld
> script is provided to gcc, while redhat-hardened-cc1 script is missed.
> That leads to an error on s390:
>
> /usr/bin/ld: /tmp/ccUT8Rdm.o: `stderr@@GLIBC_2.2' non-PLT reloc for
> symbol defined in shared library and accessed from executable (rebuild
> file with -fPIC ?)
>
> Provide both KBUILD_HOSTCFLAGS and KBUILD_HOSTLDFLAGS to avoid that.
>
> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>

FWIW, I already fielded some reports about this, and proposed a very
similar (but not identical) fix:

https://lore.kernel.org/lkml/20240814030436.2022155-1-briannorris@chromium.org/

Frankly, I wasn't sure about HOSTxxFLAGS vs KBUILD_HOSTxxFLAGS -- and
that's the difference between yours and mine. If yours works, that
looks like the cleaner solution. So:

Reviewed-by: Brian Norris <briannorris@chromium.org>

Either way, it might be good to also include some of these tags if
this is committed:

Closes: https://lore.kernel.org/lkml/99ae0d34-ed76-4ca0-a9fd-c337da33c9f9@leemhuis.info/
Fixes: ea974028a049 ("tools build: Avoid circular .fixdep-in.o.cmd issues")

Brian
Alexander Gordeev Aug. 14, 2024, 5:53 p.m. UTC | #2
On Wed, Aug 14, 2024 at 10:35:00AM -0700, Brian Norris wrote:

Hi Brian,

> FWIW, I already fielded some reports about this, and proposed a very
> similar (but not identical) fix:
> 
> https://lore.kernel.org/lkml/20240814030436.2022155-1-briannorris@chromium.org/
> 
> Frankly, I wasn't sure about HOSTxxFLAGS vs KBUILD_HOSTxxFLAGS -- and
> that's the difference between yours and mine. If yours works, that
> looks like the cleaner solution. So:
> 
> Reviewed-by: Brian Norris <briannorris@chromium.org>
> 
> Either way, it might be good to also include some of these tags if
> this is committed:
> 
> Closes: https://lore.kernel.org/lkml/99ae0d34-ed76-4ca0-a9fd-c337da33c9f9@leemhuis.info/
> Fixes: ea974028a049 ("tools build: Avoid circular .fixdep-in.o.cmd issues")

Ah, I missed the issue was reported already - I would include these tags otherwise.

@Thorsten, would it be possible to test this fix?

Thanks!

> Brian
Thorsten Leemhuis Aug. 15, 2024, 7:03 a.m. UTC | #3
On 14.08.24 19:53, Alexander Gordeev wrote:
> On Wed, Aug 14, 2024 at 10:35:00AM -0700, Brian Norris wrote:
>
>> FWIW, I already fielded some reports about this, and proposed a very
>> similar (but not identical) fix:
>>
>> https://lore.kernel.org/lkml/20240814030436.2022155-1-briannorris@chromium.org/
>>
>> Frankly, I wasn't sure about HOSTxxFLAGS vs KBUILD_HOSTxxFLAGS -- and
>> that's the difference between yours and mine. If yours works, that
>> looks like the cleaner solution. So:
>>
>> Reviewed-by: Brian Norris <briannorris@chromium.org>
>>
>> Either way, it might be good to also include some of these tags if
>> this is committed:
>>
>> Closes: https://lore.kernel.org/lkml/99ae0d34-ed76-4ca0-a9fd-c337da33c9f9@leemhuis.info/
>> Fixes: ea974028a049 ("tools build: Avoid circular .fixdep-in.o.cmd issues")
> 
> Ah, I missed the issue was reported already - I would include these tags otherwise.
> 
> @Thorsten, would it be possible to test this fix?

Yeah, np. This one works as well, so feel free to add:

Tested-by: Thorsten Leemhuis <linux@leemhuis.info>

Ciao, Thorsten
Arnaldo Carvalho de Melo Aug. 15, 2024, 9:07 p.m. UTC | #4
On Thu, Aug 15, 2024 at 09:03:58AM +0200, Thorsten Leemhuis wrote:
> On 14.08.24 19:53, Alexander Gordeev wrote:
> > On Wed, Aug 14, 2024 at 10:35:00AM -0700, Brian Norris wrote:
> >
> >> FWIW, I already fielded some reports about this, and proposed a very
> >> similar (but not identical) fix:
> >>
> >> https://lore.kernel.org/lkml/20240814030436.2022155-1-briannorris@chromium.org/
> >>
> >> Frankly, I wasn't sure about HOSTxxFLAGS vs KBUILD_HOSTxxFLAGS -- and
> >> that's the difference between yours and mine. If yours works, that
> >> looks like the cleaner solution. So:
> >>
> >> Reviewed-by: Brian Norris <briannorris@chromium.org>
> >>
> >> Either way, it might be good to also include some of these tags if
> >> this is committed:
> >>
> >> Closes: https://lore.kernel.org/lkml/99ae0d34-ed76-4ca0-a9fd-c337da33c9f9@leemhuis.info/
> >> Fixes: ea974028a049 ("tools build: Avoid circular .fixdep-in.o.cmd issues")
> > 
> > Ah, I missed the issue was reported already - I would include these tags otherwise.
> > 
> > @Thorsten, would it be possible to test this fix?
> 
> Yeah, np. This one works as well, so feel free to add:
> 
> Tested-by: Thorsten Leemhuis <linux@leemhuis.info>

Thanks everybody, applied to perf-tools-next,

- Arnaldo
diff mbox series

Patch

diff --git a/tools/build/Makefile b/tools/build/Makefile
index fea3cf647f5b..18ad131f6ea7 100644
--- a/tools/build/Makefile
+++ b/tools/build/Makefile
@@ -44,4 +44,4 @@  ifneq ($(wildcard $(TMP_O)),)
 endif
 
 $(OUTPUT)fixdep: $(srctree)/tools/build/fixdep.c
-	$(QUIET_CC)$(HOSTCC) $(KBUILD_HOSTLDFLAGS) -o $@ $<
+	$(QUIET_CC)$(HOSTCC) $(KBUILD_HOSTCFLAGS) $(KBUILD_HOSTLDFLAGS) -o $@ $<