mbox series

[0/2] -fcanon-file-prefix and cc-rs compiler flag mixing

Message ID 20251120121947.3473848-1-skandigraun@gmail.com
Headers show
Series -fcanon-file-prefix and cc-rs compiler flag mixing | expand

Message

Gyorgy Sarvari Nov. 20, 2025, 12:19 p.m. UTC
These two commits are very losely related to each other.

Patch 1 adds -fcanon-prefix-map to the compiler flags, when it is applicable 
(when gcc >=13 is used). This helps with finding the correct debug sources 
for the -src package. Without this flag some recipes miss some source 
files from this package, and sometimes they miss all files. (E.g. sqlite, audiofile, librsvg)

Patch 2 tries to work around a bug (or at least unexpected behavior) in the cc-rs 
crate. 

This patch tries to recognize if there are any flags passed to the compiler that shouldn't be there.

How these patches are related: normally the *-prefix-map flags are only passed to cross-compiled 
targets. However the cc crate passes this flag to the native builds also (due to flag 
merging), and in case the host compiler is too old to recognize this flag, than the build fails.

Though I was able to build rust with both of these patches for both native and class targets,
I wasn't able to configure qemu to run in my docker env, and due to this I was unable
to verify if the selftests pass in an OS where gcc is older than v13.

While not mentioned explicitly, but especially with the 2nd patch I'm testing the waters,
it is an RFC also.

---

Gyorgy Sarvari (2):
  bitbake.conf, gcc toolchain: add -fcanon-prefix-map to map-prefixes
  rust-common.bbclass: filter out incorrect compiler flags in wrapper

 meta/classes-recipe/rust-common.bbclass   | 24 +++++++++++++++++++++++
 meta/classes/toolchain/gcc-native.bbclass |  3 +++
 meta/classes/toolchain/gcc.bbclass        |  2 ++
 meta/conf/bitbake.conf                    |  2 +-
 4 files changed, 30 insertions(+), 1 deletion(-)