* [Buildroot] generic code with i7 bootlin toolchain?
@ 2021-11-03 19:52 stsp
2021-11-04 1:05 ` Giulio Benetti
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: stsp @ 2021-11-03 19:52 UTC (permalink / raw)
To: buildroot
Hello.
I configured buildroot for
corei7 CPU to use the bootlin
tool-chain. As expected, nothing
worked, as I have the (very old)
AMD CPU.
Then I did the following:
BR2_TARGET_OPTIMIZATION="-march=x86-64 -mtune=generic"
make clean
and full rebuild.
After that I've got working
kernel and the user-space
starts booting, but still many
user-space apps or libs crash
with an illegal instruction exception.
I even checked that the toolchain-wrapper
generated by buildroot, has these
strings embedded, so my change
certainly had some effect. But
it was not enough.
So it looks like the
BR2_TARGET_OPTIMIZATION
is somehow applied not to all
built packages? Why can that be?
Is there any other way I can
utilize bootlin tool-chain for some
"generic" (non-SSE3/4) CPU?
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Buildroot] generic code with i7 bootlin toolchain?
2021-11-03 19:52 [Buildroot] generic code with i7 bootlin toolchain? stsp
@ 2021-11-04 1:05 ` Giulio Benetti
2021-11-04 10:02 ` stsp
2021-11-04 20:36 ` Yann E. MORIN
2 siblings, 0 replies; 8+ messages in thread
From: Giulio Benetti @ 2021-11-04 1:05 UTC (permalink / raw)
To: stsp; +Cc: buildroot
Hi,
> Il giorno 3 nov 2021, alle ore 21:04, stsp <stsp2@yandex.ru> ha scritto:
>
> Hello.
>
> I configured buildroot for
> corei7 CPU to use the bootlin
> tool-chain. As expected, nothing
> worked, as I have the (very old)
> AMD CPU.
> Then I did the following:
> BR2_TARGET_OPTIMIZATION="-march=x86-64 -mtune=generic"
>
> make clean
> and full rebuild.
> After that I've got working
> kernel and the user-space
> starts booting, but still many
> user-space apps or libs crash
> with an illegal instruction exception.
> I even checked that the toolchain-wrapper
> generated by buildroot, has these
> strings embedded, so my change
> certainly had some effect. But
> it was not enough.
>
> So it looks like the
> BR2_TARGET_OPTIMIZATION
> is somehow applied not to all
> built packages? Why can that be?
Unfortunately some package(I would say many) has theirself a broken way to correctly pass external C/CXX/LDFLAGS.
Usually they internally override some flag that makes null what we pass or worse they completely ignore them by using hard coded flags.
To fix this specific problem we should go through every package and fix the package build system itself(a huge work).
> Is there any other way I can
> utilize bootlin tool-chain for some
> "generic" (non-SSE3/4) CPU?
Here I leave the answer to more experienced people.
Best regards
Giulio
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Buildroot] generic code with i7 bootlin toolchain?
2021-11-03 19:52 [Buildroot] generic code with i7 bootlin toolchain? stsp
2021-11-04 1:05 ` Giulio Benetti
@ 2021-11-04 10:02 ` stsp
2021-11-04 14:55 ` Giulio Benetti
2021-11-04 20:36 ` Yann E. MORIN
2 siblings, 1 reply; 8+ messages in thread
From: stsp @ 2021-11-04 10:02 UTC (permalink / raw)
To: buildroot; +Cc: Giulio Benetti
Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:
> Unfortunately some package(I would say many) has theirself a broken way to correctly pass external C/CXX/LDFLAGS.
> Usually they internally override some flag that makes null what we pass or worse they completely ignore them by using hard coded flags.
> To fix this specific problem we should go through every package and fix the package build system itself(a huge work).
I initially thought the same way.
But it seems to be after some more
investigation the other way:
$ file
/home/stas/src/fdpp-buildroot/buildroot/output/host/bin/x86_64-linux-gcc
/home/stas/src/fdpp-buildroot/buildroot/output/host/bin/x86_64-linux-gcc:
symbolic link to toolchain-wrapper
$ file
/home/stas/src/fdpp-buildroot/buildroot/output/host/bin/toolchain-wrapper
/home/stas/src/fdpp-buildroot/buildroot/output/host/bin/toolchain-wrapper:
ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked,
interpreter /lib64/ld-linux-x86-64.so.2,
BuildID[sha1]=965fad722d4737f4373924e5b37b0973c0cd5f46, for GNU/Linux
3.2.0, stripped
So it looks like buildroot creates
the toolchain-wrapper binary as
a replacement of gcc, and that
binary would invoke gcc (and
perhaps ccache too) with the
needed flags.
So such scheme should resist to
the "bad" packages you mention
because it doesn't rely on them
handling CFLAGS correctly.
There might be some other explanation
to the problem I see.
Thinking more about this - maybe
libgcc or some other lib from the
bootlin toolchain is over-optimized?
In that case I should ask at bootlin
perhaps instead...
Please CC me the replies if possible.
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Buildroot] generic code with i7 bootlin toolchain?
2021-11-04 10:02 ` stsp
@ 2021-11-04 14:55 ` Giulio Benetti
2021-11-04 15:07 ` stsp
0 siblings, 1 reply; 8+ messages in thread
From: Giulio Benetti @ 2021-11-04 14:55 UTC (permalink / raw)
To: stsp, buildroot
Hi,
On 11/4/21 11:02 AM, stsp wrote:
> Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:
>> Unfortunately some package(I would say many) has theirself a broken way to correctly pass external C/CXX/LDFLAGS.
>> Usually they internally override some flag that makes null what we pass or worse they completely ignore them by using hard coded flags.
>> To fix this specific problem we should go through every package and fix the package build system itself(a huge work).
> I initially thought the same way.
> But it seems to be after some more
> investigation the other way:
> $ file
> /home/stas/src/fdpp-buildroot/buildroot/output/host/bin/x86_64-linux-gcc
> /home/stas/src/fdpp-buildroot/buildroot/output/host/bin/x86_64-linux-gcc:
> symbolic link to toolchain-wrapper
> $ file
> /home/stas/src/fdpp-buildroot/buildroot/output/host/bin/toolchain-wrapper
> /home/stas/src/fdpp-buildroot/buildroot/output/host/bin/toolchain-wrapper:
> ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked,
> interpreter /lib64/ld-linux-x86-64.so.2,
> BuildID[sha1]=965fad722d4737f4373924e5b37b0973c0cd5f46, for GNU/Linux
> 3.2.0, stripped
>
> So it looks like buildroot creates
> the toolchain-wrapper binary as
> a replacement of gcc, and that
> binary would invoke gcc (and
> perhaps ccache too) with the
> needed flags.
Yes
> So such scheme should resist to
> the "bad" packages you mention
> because it doesn't rely on them
> handling CFLAGS correctly.
> There might be some other explanation
> to the problem I see.
No, it doesn't resist to the "bad" packages. Try to imagine an
auto-tools package where you can pass CFLAGS, but in Makefile.in you
find out that it does come check and it append something like "-O2" and
instead you want "-O0", but this way you will end up having CFLAGS="...
-O0 -O2". This overrides the optimization flag, so this doesn't solve
the problem.
> Thinking more about this - maybe
> libgcc or some other lib from the
> bootlin toolchain is over-optimized?
> In that case I should ask at bootlin
> perhaps instead...
I don't see how it could help, also what you mean with over-optimized?
Do you mean that -Os on building Bootlin toolchain could lead to the
toolchain to fail in some way?
> Please CC me the replies if possible.
This is what I do, I "Answer to all" including the ML.
Anyway here I think we're losing the focus of the previous e-mail that
you can't build for AMD. Can you provide the exact CPU model you're
buildling for?
Best regards
--
Giulio Benetti
Benetti Engineering sas
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Buildroot] generic code with i7 bootlin toolchain?
2021-11-04 14:55 ` Giulio Benetti
@ 2021-11-04 15:07 ` stsp
0 siblings, 0 replies; 8+ messages in thread
From: stsp @ 2021-11-04 15:07 UTC (permalink / raw)
To: Giulio Benetti, buildroot
Hi,
04.11.2021 17:55, Giulio Benetti пишет:
>> So such scheme should resist to
>> the "bad" packages you mention
>> because it doesn't rely on them
>> handling CFLAGS correctly.
>> There might be some other explanation
>> to the problem I see.
>
> No, it doesn't resist to the "bad" packages. Try to imagine an
> auto-tools package where you can pass CFLAGS, but in Makefile.in you
> find out that it does come check and it append something like "-O2"
> and instead you want "-O0", but this way you will end up having
> CFLAGS="... -O0 -O2". This overrides the optimization flag, so this
> doesn't solve the problem.
You mean someone overrides
my -march -mcpu? But doesn't
that sound unlikely? Yes, -O can
be overridden, sure, but -march...
>> Thinking more about this - maybe
>> libgcc or some other lib from the
>> bootlin toolchain is over-optimized?
>> In that case I should ask at bootlin
>> perhaps instead...
>
> I don't see how it could help, also what you mean with over-optimized?
> Do you mean that -Os on building Bootlin toolchain could lead to the
> toolchain to fail in some way?
I mean by the use of SSE3/4 that
my CPU does not have.
>> Please CC me the replies if possible.
>
> This is what I do, I "Answer to all" including the ML.
Sorry, yandex put it to spam. :(
> Anyway here I think we're losing the focus of the previous e-mail that
> you can't build for AMD. Can you provide the exact CPU model you're
> buildling for?
model name : AMD Phenom(tm) II X4 955 Processor
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca
cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt
pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nopl nonstop_tsc
cpuid extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic
cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt
nodeid_msr hw_pstate vmmcall npt lbrv svm_lock nrip_save
So it seems to have SSE, SSE2, SSE4a?
Doesn't seem to have SSE3, which might
be the problem. I suspect the libs from
bootlin tool-chain already use SSE3, so
that can't be cured other than by the
tool-chain rebuild.
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Buildroot] generic code with i7 bootlin toolchain?
2021-11-03 19:52 [Buildroot] generic code with i7 bootlin toolchain? stsp
2021-11-04 1:05 ` Giulio Benetti
2021-11-04 10:02 ` stsp
@ 2021-11-04 20:36 ` Yann E. MORIN
2021-11-04 20:59 ` stsp
2 siblings, 1 reply; 8+ messages in thread
From: Yann E. MORIN @ 2021-11-04 20:36 UTC (permalink / raw)
To: stsp; +Cc: buildroot
Stsp, All,
On 2021-11-03 22:52 +0300, stsp spake thusly:
> I configured buildroot for
> corei7 CPU to use the bootlin
> tool-chain. As expected, nothing
> worked, as I have the (very old)
> AMD CPU.
> Then I did the following:
> BR2_TARGET_OPTIMIZATION="-march=x86-64 -mtune=generic"
Do not use BR2_TARGET_OPTIMIZATION to set your CPU model. Instead,
select the proper entry in the target variant choice. Selecting the
proper variant will pass appropriate -march and -mcpu options.
If a toolchain is not available for the CPU you have (and which you
select in the choice I mentioned above), then that is on-purpose,
because that toolchain is not usable for that CPU; see below...
> make clean
> and full rebuild.
> After that I've got working
> kernel and the user-space
> starts booting, but still many
> user-space apps or libs crash
> with an illegal instruction exception.
>
> I even checked that the toolchain-wrapper
> generated by buildroot, has these
> strings embedded, so my change
> certainly had some effect. But
> it was not enough.
This is not unsurprising. The toolchain contains the C lirbary, which
has been built with the optimisations for core-i7. So using that
toolchain for a CPU that lacks some features of a core-i7 will not work.
> So it looks like the
> BR2_TARGET_OPTIMIZATION
> is somehow applied not to all
> built packages? Why can that be?
> Is there any other way I can
> utilize bootlin tool-chain for some
> "generic" (non-SSE3/4) CPU?
You will not be able to use that toolchain for the Phenom. You will have
to build your own toolchain.
Note that you can build the toolchain once, and later re-use that as a
pre-built toolchain. See the manual on directions on how to do that:
https://buildroot.org/downloads/manual/manual.html#_cross_compilation_toolchain
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Buildroot] generic code with i7 bootlin toolchain?
2021-11-04 20:36 ` Yann E. MORIN
@ 2021-11-04 20:59 ` stsp
2021-11-05 21:21 ` Yann E. MORIN
0 siblings, 1 reply; 8+ messages in thread
From: stsp @ 2021-11-04 20:59 UTC (permalink / raw)
To: Yann E. MORIN; +Cc: buildroot
Hi,
04.11.2021 23:36, Yann E. MORIN пишет:
>> So it looks like the
>> BR2_TARGET_OPTIMIZATION
>> is somehow applied not to all
>> built packages? Why can that be?
>> Is there any other way I can
>> utilize bootlin tool-chain for some
>> "generic" (non-SSE3/4) CPU?
> You will not be able to use that toolchain for the Phenom. You will have
> to build your own toolchain.
>
> Note that you can build the toolchain once, and later re-use that as a
> pre-built toolchain. See the manual on directions on how to do that:
> https://buildroot.org/downloads/manual/manual.html#_cross_compilation_toolchain
Thanks, "make sdk" is an
interesting subject to play with.
However, any hopes bootlin
can provide the "generic"
tool-chain in addition to i7?
Also the doc you mentioned,
points to some codesourcery
tool-chain. Where is it?
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Buildroot] generic code with i7 bootlin toolchain?
2021-11-04 20:59 ` stsp
@ 2021-11-05 21:21 ` Yann E. MORIN
0 siblings, 0 replies; 8+ messages in thread
From: Yann E. MORIN @ 2021-11-05 21:21 UTC (permalink / raw)
To: stsp; +Cc: buildroot
Sstp, All,
On 2021-11-04 23:59 +0300, stsp spake thusly:
> 04.11.2021 23:36, Yann E. MORIN пишет:
> >>So it looks like the
> >>BR2_TARGET_OPTIMIZATION
> >>is somehow applied not to all
> >>built packages? Why can that be?
> >>Is there any other way I can
> >>utilize bootlin tool-chain for some
> >>"generic" (non-SSE3/4) CPU?
> >You will not be able to use that toolchain for the Phenom. You will have
> >to build your own toolchain.
> >
> >Note that you can build the toolchain once, and later re-use that as a
> >pre-built toolchain. See the manual on directions on how to do that:
> > https://buildroot.org/downloads/manual/manual.html#_cross_compilation_toolchain
> Thanks, "make sdk" is an
> interesting subject to play with.
> However, any hopes bootlin
> can provide the "generic"
> tool-chain in addition to i7?
That's up to them to decide what they provide and host. Maybe you can
contract with them? ;-)
> Also the doc you mentioned,
> points to some codesourcery
> tool-chain. Where is it?
The manual is not up-to-date in this respect: there is no longer a
CodeSourcery toolchain for x86/x86-64 anymore (see commit d87e114a8ffa).
Regards,
Yann E. MORIN.
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-11-05 21:21 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-03 19:52 [Buildroot] generic code with i7 bootlin toolchain? stsp
2021-11-04 1:05 ` Giulio Benetti
2021-11-04 10:02 ` stsp
2021-11-04 14:55 ` Giulio Benetti
2021-11-04 15:07 ` stsp
2021-11-04 20:36 ` Yann E. MORIN
2021-11-04 20:59 ` stsp
2021-11-05 21:21 ` Yann E. MORIN
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox