diff mbox series

gcc: remove paths to sysroot from configargs.h and checksum-options for gcc-cross-canadian

Message ID 20240712110050.2211164-1-ohnatiuk@cisco.com
State New
Headers show
Series gcc: remove paths to sysroot from configargs.h and checksum-options for gcc-cross-canadian | expand

Commit Message

Copy fixes for gcc-cross (84a78f46d594 and 0ead8cbdfb96) to gcc-cross-canadian.
This will improve (but not fix) reproducibility of gcc-cross-canadian.

Signed-off-by: Oleksandr Hnatiuk <ohnatiuk@cisco.com>
---
 meta/recipes-devtools/gcc/gcc-cross-canadian.inc | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Alexander Kanavin July 12, 2024, 11:17 a.m. UTC | #1
On Fri, 12 Jul 2024 at 13:01, Oleksandr Hnatiuk via
lists.openembedded.org <ohnatiuk=cisco.com@lists.openembedded.org>
wrote:
> +       sed -i 's@${DEBUG_PREFIX_MAP}@@g' ${B}/gcc/checksum-options
> +       sed -i 's@${STAGING_DIR_HOST}@/host@g' ${B}/gcc/checksum-options

The sed stuff here should also go to a function instead of being copy-pasted.

Alex
Hi Alex,

gcc recipe structure is quite complex. Where should I put these common functions? gcc-configure-common.inc ?
I see that all 3 files (gcc-target.inc, gcc-cross.inc, gcc-cross-canadian.inc) which use this code `require gcc-configure-common.inc`.

Thanks,
Oleksandr
Alexander Kanavin July 15, 2024, 12:30 p.m. UTC | #3
On Fri, 12 Jul 2024 at 21:22, Oleksandr Hnatiuk via
lists.openembedded.org <ohnatiuk=cisco.com@lists.openembedded.org>
wrote:
> gcc recipe structure is quite complex. Where should I put these common functions? gcc-configure-common.inc ?
> I see that all 3 files (gcc-target.inc, gcc-cross.inc, gcc-cross-canadian.inc) which use this code `require gcc-configure-common.inc`.

Yes, I think that'd be the best location.

Alex
diff mbox series

Patch

diff --git a/meta/recipes-devtools/gcc/gcc-cross-canadian.inc b/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
index 7c4233c21157..127f97473f91 100644
--- a/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
+++ b/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
@@ -64,6 +64,20 @@  do_configure () {
 }
 
 do_compile () {
+	# Prevent native/host sysroot path from being used in configargs.h header,
+	# as it will be rewritten when used by other sysroots preventing support
+	# for gcc plugins
+	oe_runmake configure-gcc
+	sed -i 's@${STAGING_DIR_TARGET}@/host@g' ${B}/gcc/configargs.h
+	sed -i 's@${STAGING_DIR_HOST}@/host@g' ${B}/gcc/configargs.h
+
+	# Prevent sysroot/workdir paths from being used in checksum-options.
+	# checksum-options is used to generate a checksum which is embedded into
+	# the output binary.
+	oe_runmake TARGET-gcc=checksum-options all-gcc
+	sed -i 's@${DEBUG_PREFIX_MAP}@@g' ${B}/gcc/checksum-options
+	sed -i 's@${STAGING_DIR_HOST}@/host@g' ${B}/gcc/checksum-options
+
 	oe_runmake all-host configure-target-libgcc
 	(cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h)
 }