Skip to contentSkip to conversation

gcc: don't ship build host information in the target gcc-plugins package

PATCH In review Richard Purdie 2 participants 10 messages Mar 10, 2020 – Mar 11, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 gcc: don't ship build host information in the target gcc-plugins package

From: Ross Burton <[email protected]>

The build host configuration isn't reproducible as it varies depending on the gcc version of the build host. This information isn't useful on the target anyway so remove it.

---
 meta/recipes-devtools/gcc/gcc-target.inc | 4 ++++
 1 file changed, 4 insertions(+)
meta/recipes-devtools/gcc/gcc-target.inc +4 -0
index 18d078db0af..204f9475fc5 100644
@@ -179,6 +179,10 @@ do_install () {
 	# Cleanup manpages..
 	rm -rf ${D}${mandir}/man7
 
+	# Don't package details about the build host
+	rm -f ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/plugin/include/auto-build.h
+	rm -f ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/plugin/include/bconfig.h
+
 	cd ${D}${bindir}
 
 	# We care about g++ not c++
Signature · 1 line
2.25.0
#1 lore raw

PATCH 2/6 gcc: strip line numbers from generated code in gcc-plugins on target

From: Ross Burton <[email protected]>

The line numbers are influenced by the gcc version on the host used to generate the code. Remove these to ensure the shipped source code is the same.

---
 meta/recipes-devtools/gcc/gcc-9.2.inc         |   1 +
 .../gcc/gcc-9.2/gen-no-line-numbers.patch     | 170 ++++++++++++++++++
 2 files changed, 171 insertions(+)
 create mode 100644 meta/recipes-devtools/gcc/gcc-9.2/gen-no-line-numbers.patch
meta/recipes-devtools/gcc/gcc-9.2.inc +1 -0
index 2bae85afe3a..2368f358675 100644
@@ -70,6 +70,7 @@ SRC_URI = "\
 	   file://CVE-2019-15847_2.patch \
 	   file://CVE-2019-15847_3.patch \
            file://re-PR-target-91102-aarch64-ICE-on-Linux-kernel-with-.patch \
+           file://gen-no-line-numbers.patch \
 "
 S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
 SRC_URI[md5sum] = "3818ad8600447f05349098232c2ddc78"
meta/recipes-devtools/gcc/gcc-9.2/gen-no-line-numbers.patch new file +170 -0

170 lines not on this page · raw message

Signature · 1 line
2.25.0
#2 lore raw

Re: [PATCH 2/6] gcc: strip line numbers from generated code in gcc-plugins on target

Quoted 5 lines · Richard Purdie

From: Ross Burton <[email protected]>

The line numbers are influenced by the gcc version on the host used to generate the code. Remove these to ensure the shipped source code is the same.

Please send this paatch to gcc mailing lists for review, I am not sure if this will cause regressions for plugin writers since it does not seem simple debug info that it is adding, and external plugins might rely on this information. While I understand it might solve our usecaase its a kind of patch that I worry about to carry out of tree.

Quoted 196 lines
---
  meta/recipes-devtools/gcc/gcc-9.2.inc         |   1 +
  .../gcc/gcc-9.2/gen-no-line-numbers.patch     | 170 ++++++++++++++++++
  2 files changed, 171 insertions(+)

create mode 100644 meta/recipes-devtools/gcc/gcc-9.2/gen-no-line-numbers.patch

meta/recipes-devtools/gcc/gcc-9.2.inc +1 -0
index 2bae85afe3a..2368f358675 100644
@@ -70,6 +70,7 @@ SRC_URI = "\
  	   file://CVE-2019-15847_2.patch \
  	   file://CVE-2019-15847_3.patch \
             file://re-PR-target-91102-aarch64-ICE-on-Linux-kernel-with-.patch \
+           file://gen-no-line-numbers.patch \
  "
  S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
  SRC_URI[md5sum] = "3818ad8600447f05349098232c2ddc78"
meta/recipes-devtools/gcc/gcc-9.2/gen-no-line-numbers.patch new file +170 -0
new file mode 100644
index 00000000000..8e2c3f58095
@@ -0,0 +1,170 @@
+Inserting line numbers into generated code means its not always reproducible wth
+differing versions of host gcc. Void the issue by not adding these.
+
+Upstream-Status: Inappropriate [OE Reproducibility specific]
+Signed-off-by: Richard Purdie <[email protected]>
+
+diff --git a/gcc/gengtype.c b/gcc/gengtype.c
+index 53317337c..bbb261516 100644
+--- a/gcc/gengtype.c
++++ b/gcc/gengtype.c
+@@ -991,7 +991,7 @@ create_field_at (pair_p next, type_p type, const char *name, options_p opt,
+ /* Create a fake field with the given type and name.  NEXT is the next
+    field in the chain.  */
+ #define create_field(next,type,name) \
+-    create_field_all (next,type,name, 0, this_file, __LINE__)
++    create_field_all (next,type,name, 0, this_file, 0)
+
+ /* Like create_field, but the field is only valid when condition COND
+    is true.  */
+@@ -1024,7 +1024,7 @@ create_optional_field_ (pair_p next, type_p type, const char *name,
+ }
+
+ #define create_optional_field(next,type,name,cond)	\
+-       create_optional_field_(next,type,name,cond,__LINE__)
++       create_optional_field_(next,type,name,cond,0)
+
+ /* Reverse a linked list of 'struct pair's in place.  */
+ pair_p
+@@ -5186,7 +5186,7 @@ main (int argc, char **argv)
+       /* These types are set up with #define or else outside of where
+          we can see them.  We should initialize them before calling
+          read_input_list.  */
+-#define POS_HERE(Call) do { pos.file = this_file; pos.line = __LINE__; \
++#define POS_HERE(Call) do { pos.file = this_file; pos.line = 0; \
+ 	Call;} while (0)
+       POS_HERE (do_scalar_typedef ("CUMULATIVE_ARGS", &pos));
+       POS_HERE (do_scalar_typedef ("REAL_VALUE_TYPE", &pos));
+diff --git a/gcc/genmodes.c b/gcc/genmodes.c
+index f33eefa24..07bef9eeb 100644
+--- a/gcc/genmodes.c
++++ b/gcc/genmodes.c
+@@ -429,7 +429,7 @@ complete_all_modes (void)
+ }
+
+ /* For each mode in class CLASS, construct a corresponding complex mode.  */
+-#define COMPLEX_MODES(C) make_complex_modes (MODE_##C, __FILE__, __LINE__)
++#define COMPLEX_MODES(C) make_complex_modes (MODE_##C, __FILE__, 0)
+ static void
+ make_complex_modes (enum mode_class cl,
+ 		    const char *file, unsigned int line)
+@@ -487,7 +487,7 @@ make_complex_modes (enum mode_class cl,
+ /* For all modes in class CL, construct vector modes of width
+    WIDTH, having as many components as necessary.  */
+ #define VECTOR_MODES_WITH_PREFIX(PREFIX, C, W) \
+-  make_vector_modes (MODE_##C, #PREFIX, W, __FILE__, __LINE__)
++  make_vector_modes (MODE_##C, #PREFIX, W, __FILE__, 0)
+ #define VECTOR_MODES(C, W) VECTOR_MODES_WITH_PREFIX (V, C, W)
+ static void ATTRIBUTE_UNUSED
+ make_vector_modes (enum mode_class cl, const char *prefix, unsigned int width,
+@@ -538,7 +538,7 @@ make_vector_modes (enum mode_class cl, const char *prefix, unsigned int width,
+ /* Create a vector of booleans called NAME with COUNT elements and
+    BYTESIZE bytes in total.  */
+ #define VECTOR_BOOL_MODE(NAME, COUNT, BYTESIZE) \
+-  make_vector_bool_mode (#NAME, COUNT, BYTESIZE, __FILE__, __LINE__)
++  make_vector_bool_mode (#NAME, COUNT, BYTESIZE, __FILE__, 0)
+ static void ATTRIBUTE_UNUSED
+ make_vector_bool_mode (const char *name, unsigned int count,
+ 		       unsigned int bytesize, const char *file,
+@@ -560,7 +560,7 @@ make_vector_bool_mode (const char *name, unsigned int count,
+ /* Input.  */
+
+ #define _SPECIAL_MODE(C, N) \
+-  make_special_mode (MODE_##C, #N, __FILE__, __LINE__)
++  make_special_mode (MODE_##C, #N, __FILE__, 0)
+ #define RANDOM_MODE(N) _SPECIAL_MODE (RANDOM, N)
+ #define CC_MODE(N) _SPECIAL_MODE (CC, N)
+
+@@ -573,7 +573,7 @@ make_special_mode (enum mode_class cl, const char *name,
+
+ #define INT_MODE(N, Y) FRACTIONAL_INT_MODE (N, -1U, Y)
+ #define FRACTIONAL_INT_MODE(N, B, Y) \
+-  make_int_mode (#N, B, Y, __FILE__, __LINE__)
++  make_int_mode (#N, B, Y, __FILE__, 0)
+
+ static void
+ make_int_mode (const char *name,
+@@ -586,16 +586,16 @@ make_int_mode (const char *name,
+ }
+
+ #define FRACT_MODE(N, Y, F) \
+-	make_fixed_point_mode (MODE_FRACT, #N, Y, 0, F, __FILE__, __LINE__)
++	make_fixed_point_mode (MODE_FRACT, #N, Y, 0, F, __FILE__, 0)
+
+ #define UFRACT_MODE(N, Y, F) \
+-	make_fixed_point_mode (MODE_UFRACT, #N, Y, 0, F, __FILE__, __LINE__)
++	make_fixed_point_mode (MODE_UFRACT, #N, Y, 0, F, __FILE__, 0)
+
+ #define ACCUM_MODE(N, Y, I, F) \
+-	make_fixed_point_mode (MODE_ACCUM, #N, Y, I, F, __FILE__, __LINE__)
++	make_fixed_point_mode (MODE_ACCUM, #N, Y, I, F, __FILE__, 0)
+
+ #define UACCUM_MODE(N, Y, I, F) \
+-	make_fixed_point_mode (MODE_UACCUM, #N, Y, I, F, __FILE__, __LINE__)
++	make_fixed_point_mode (MODE_UACCUM, #N, Y, I, F, __FILE__, 0)
+
+ /* Create a fixed-point mode by setting CL, NAME, BYTESIZE, IBIT, FBIT,
+    FILE, and LINE.  */
+@@ -616,7 +616,7 @@ make_fixed_point_mode (enum mode_class cl,
+
+ #define FLOAT_MODE(N, Y, F)             FRACTIONAL_FLOAT_MODE (N, -1U, Y, F)
+ #define FRACTIONAL_FLOAT_MODE(N, B, Y, F) \
+-  make_float_mode (#N, B, Y, #F, __FILE__, __LINE__)
++  make_float_mode (#N, B, Y, #F, __FILE__, 0)
+
+ static void
+ make_float_mode (const char *name,
+@@ -633,7 +633,7 @@ make_float_mode (const char *name,
+ #define DECIMAL_FLOAT_MODE(N, Y, F)	\
+ 	FRACTIONAL_DECIMAL_FLOAT_MODE (N, -1U, Y, F)
+ #define FRACTIONAL_DECIMAL_FLOAT_MODE(N, B, Y, F)	\
+-  make_decimal_float_mode (#N, B, Y, #F, __FILE__, __LINE__)
++  make_decimal_float_mode (#N, B, Y, #F, __FILE__, 0)
+
+ static void
+ make_decimal_float_mode (const char *name,
+@@ -648,7 +648,7 @@ make_decimal_float_mode (const char *name,
+ }
+
+ #define RESET_FLOAT_FORMAT(N, F) \
+-  reset_float_format (#N, #F, __FILE__, __LINE__)
++  reset_float_format (#N, #F, __FILE__, 0)
+ static void ATTRIBUTE_UNUSED
+ reset_float_format (const char *name, const char *format,
+ 		    const char *file, unsigned int line)
+@@ -669,7 +669,7 @@ reset_float_format (const char *name, const char *format,
+
+ /* __intN support.  */
+ #define INT_N(M,PREC)				\
+-  make_int_n (#M, PREC, __FILE__, __LINE__)
++  make_int_n (#M, PREC, __FILE__, 0)
+ static void ATTRIBUTE_UNUSED
+ make_int_n (const char *m, int bitsize,
+             const char *file, unsigned int line)
+@@ -698,7 +698,7 @@ make_int_n (const char *m, int bitsize,
+ /* Partial integer modes are specified by relation to a full integer
+    mode.  */
+ #define PARTIAL_INT_MODE(M,PREC,NAME)				\
+-  make_partial_integer_mode (#M, #NAME, PREC, __FILE__, __LINE__)
++  make_partial_integer_mode (#M, #NAME, PREC, __FILE__, 0)
+ static void ATTRIBUTE_UNUSED
+ make_partial_integer_mode (const char *base, const char *name,
+ 			   unsigned int precision,
+@@ -725,7 +725,7 @@ make_partial_integer_mode (const char *base, const char *name,
+ /* A single vector mode can be specified by naming its component
+    mode and the number of components.  */
+ #define VECTOR_MODE(C, M, N) \
+-  make_vector_mode (MODE_##C, #M, N, __FILE__, __LINE__);
++  make_vector_mode (MODE_##C, #M, N, __FILE__, 0);
+ static void ATTRIBUTE_UNUSED
+ make_vector_mode (enum mode_class bclass,
+ 		  const char *base,
+@@ -768,7 +768,7 @@ make_vector_mode (enum mode_class bclass,
+
+ /* Adjustability.  */
+ #define _ADD_ADJUST(A, M, X, C1, C2) \
+-  new_adjust (#M, &adj_##A, #A, #X, MODE_##C1, MODE_##C2, __FILE__, __LINE__)
++  new_adjust (#M, &adj_##A, #A, #X, MODE_##C1, MODE_##C2, __FILE__, 0)
+
+ #define ADJUST_NUNITS(M, X)    _ADD_ADJUST (nunits, M, X, RANDOM, RANDOM)
+ #define ADJUST_BYTESIZE(M, X)  _ADD_ADJUST (bytesize, M, X, RANDOM, RANDOM)
#3 lore raw

Re: [PATCH 2/6] gcc: strip line numbers from generated code in gcc-plugins on target

Quoted 10 lines · Khem Raj
Quoted 7 lines · Richard Purdie

From: Ross Burton <[email protected]>

The line numbers are influenced by the gcc version on the host used to generate
the code. Remove these to ensure the shipped source code is the same.

Quoted 6 lines

Please send this paatch to gcc mailing lists for review, I am not sure if this will cause regressions for plugin writers since it does not seem simple debug info that it is adding, and external plugins might rely on this information. While I understand it might solve our usecaase its a kind of patch that I worry about to carry out of tree.

I very much doubt upstream are going to accept anything like it unfortunately. Whilst much of the information is useful to plugins, I'm struggling to see how/why they'd use line numbers outside of debug information so I've assumed so far they're just that - for debug. DO you know of it being used in other ways?

Cheers,

Richard

#4 lore raw

Re: [PATCH 2/6] gcc: strip line numbers from generated code in gcc-plugins on target

Quoted 18 lines · Richard Purdie
Quoted 10 lines · Khem Raj
Quoted 7 lines · Richard Purdie

From: Ross Burton <[email protected]>

The line numbers are influenced by the gcc version on the host used to generate
the code. Remove these to ensure the shipped source code is the same.

Quoted 6 lines

Please send this paatch to gcc mailing lists for review, I am not sure if this will cause regressions for plugin writers since it does not seem simple debug info that it is adding, and external plugins might rely on this information. While I understand it might solve our usecaase its a kind of patch that I worry about to carry out of tree.

Quoted 6 lines

I very much doubt upstream are going to accept anything like it unfortunately. Whilst much of the information is useful to plugins, I'm struggling to see how/why they'd use line numbers outside of debug information so I've assumed so far they're just that - for debug. DO you know of it being used in other ways?

I am not looking for them to integrate it as it is, but to get reviews if this is something we are not setting ourselves for more trouble by doing this. Since lot of plugin writers will be there and can give useful feedback.

Quoted 4 lines

Cheers,

Richard

#5 lore raw

PATCH 3/6 oeqa/testsdk: Use original PATH

In reply to Richard Purdie

We want to test the SDK with PATH from the original host, not with our own tools injected via HOSTTOOLS. It even uses some tools which aren't in HOSTTOOLS.

This is necessary after changing the SDK to not reset PATH to the system default which is bad for other reasons and brings the testing into sync with that change.

---
 meta/lib/oeqa/sdkext/testsdk.py | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
meta/lib/oeqa/sdkext/testsdk.py +2 -5
index 785b5dda53a..c5c46df6cda 100644
@@ -25,11 +25,8 @@ class TestSDKExt(TestSDKBase):
 
         subprocesstweak.errors_have_output()
 
-        # extensible sdk can be contaminated if native programs are
-        # in PATH, i.e. use perl-native instead of eSDK one.
-        paths_to_avoid = [d.getVar('STAGING_DIR'),
-                        d.getVar('BASE_WORKDIR')]
-        os.environ['PATH'] = avoid_paths_in_environ(paths_to_avoid)
+        # We need the original PATH for testing the eSDK, not with our manipulations
+        os.environ['PATH'] = d.getVar("BB_ORIGENV", False).getVar("PATH")
 
         tcname = d.expand("${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.sh")
         if not os.path.exists(tcname):
Signature · 1 line
2.25.0
#6 lore raw

PATCH 4/6 files/toolchain-shar-extract.sh: Rework PATH cleaning

In reply to Richard Purdie

Trying to create a clean PATH breaks cases where we install a buildtools tarball on hosts to provide newer versions of gcc. Rework the fix for #8698 to clean up directories in PATH which don't exist isntead. Do it with python as the shell version was too fraught with corner cases.

---
 meta/files/toolchain-shar-extract.sh | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
meta/files/toolchain-shar-extract.sh +3 -8
index 4c4b4deb4cf..2e0fe94963f 100644
@@ -1,13 +1,8 @@
 #!/bin/sh
 
-[ -z "$ENVCLEANED" ] && exec /usr/bin/env -i ENVCLEANED=1 HOME="$HOME" \
-	LC_ALL=en_US.UTF-8 \
-	TERM=$TERM \
-	ICECC_PATH="$ICECC_PATH" \
-	http_proxy="$http_proxy" https_proxy="$https_proxy" ftp_proxy="$ftp_proxy" \
-	no_proxy="$no_proxy" all_proxy="$all_proxy" GIT_PROXY_COMMAND="$GIT_PROXY_COMMAND" "$0" "$@"
-[ -f /etc/environment ] && . /etc/environment
-export PATH=`echo "$PATH" | sed -e 's/:\.//' -e 's/::/:/'`
+export LC_ALL=en_US.UTF-8
+# Remove invalid PATH elements first (maybe from a previously setup toolchain now deleted
+PATH=`python3 -c 'import os; print(":".join(e for e in os.environ["PATH"].split(":") if os.path.exists(e)))'`
 
 tweakpath () {
     case ":${PATH}:" in
Signature · 1 line
2.25.0
#7 lore raw

PATCH 5/6 glibc: Update nativesdk locale relocation patch

In reply to Richard Purdie

The locale binary reported incorrect locale lists in relocated toolchains as some path references were not relocated by this patch. Fix this missing relocations so the locale binary correctly reports the locales.

---
 ...Make-relocatable-install-for-locales.patch | 62 ++++++++++++++-----
 1 file changed, 47 insertions(+), 15 deletions(-)
meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch +47 -15
index d9985c2fdc8..27cd17cdcdf 100644
@@ -17,11 +17,11 @@ Signed-off-by: Khem Raj <[email protected]>
  locale/localeinfo.h  | 2 +-
  3 files changed, 4 insertions(+), 4 deletions(-)
 
-diff --git a/locale/findlocale.c b/locale/findlocale.c
-index 9cd3b71a6d..84272310e0 100644
---- a/locale/findlocale.c
-+++ b/locale/findlocale.c
-@@ -56,7 +56,7 @@ struct __locale_data *const _nl_C[] attribute_hidden =
+Index: git/locale/findlocale.c
+===================================================================
+--- git.orig/locale/findlocale.c
++++ git/locale/findlocale.c
+@@ -56,7 +56,7 @@ struct __locale_data *const _nl_C[] attr
     which are somehow addressed.  */
  struct loaded_l10nfile *_nl_locale_file_list[__LC_LAST];
  
@@ -30,7 +30,7 @@ index 9cd3b71a6d..84272310e0 100644
  
  /* Checks if the name is actually present, that is, not NULL and not
     empty.  */
-@@ -166,7 +166,7 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
+@@ -166,7 +166,7 @@ _nl_find_locale (const char *locale_path
  
        /* Nothing in the archive.  Set the default path to search below.  */
        locale_path = _nl_default_locale_path;
@@ -39,10 +39,10 @@ index 9cd3b71a6d..84272310e0 100644
      }
    else
      /* We really have to load some data.  First see whether the name is
-diff --git a/locale/loadarchive.c b/locale/loadarchive.c
-index ba0fe45648..9737fd4cda 100644
---- a/locale/loadarchive.c
-+++ b/locale/loadarchive.c
+Index: git/locale/loadarchive.c
+===================================================================
+--- git.orig/locale/loadarchive.c
++++ git/locale/loadarchive.c
 @@ -42,7 +42,7 @@
  
  
@@ -52,11 +52,11 @@ index ba0fe45648..9737fd4cda 100644
  
  /* Size of initial mapping window, optimal if large enough to
     cover the header plus the initial locale.  */
-diff --git a/locale/localeinfo.h b/locale/localeinfo.h
-index 1bfe22aa7f..fdc283c69a 100644
---- a/locale/localeinfo.h
-+++ b/locale/localeinfo.h
-@@ -331,7 +331,7 @@ _nl_lookup_word (locale_t l, int category, int item)
+Index: git/locale/localeinfo.h
+===================================================================
+--- git.orig/locale/localeinfo.h
++++ git/locale/localeinfo.h
+@@ -331,7 +331,7 @@ _nl_lookup_word (locale_t l, int categor
  }
  
  /* Default search path if no LOCPATH environment variable.  */
@@ -65,3 +65,35 @@ index 1bfe22aa7f..fdc283c69a 100644
  
  /* Load the locale data for CATEGORY from the file specified by *NAME.
     If *NAME is "", use environment variables as specified by POSIX, and
+Index: git/locale/programs/locale.c
+===================================================================
+--- git.orig/locale/programs/locale.c
++++ git/locale/programs/locale.c
+@@ -632,6 +632,7 @@ nameentcmp (const void *a, const void *b
+ 		  ((const struct nameent *) b)->name);
+ }
+ 
++static char _write_archive_locales_path[4096] attribute_hidden __attribute__ ((section (".gccrelocprefix"))) = ARCHIVE_NAME;
+ 
+ static int
+ write_archive_locales (void **all_datap, char *linebuf)
+@@ -645,7 +646,7 @@ write_archive_locales (void **all_datap,
+   int fd, ret = 0;
+   uint32_t cnt;
+ 
+-  fd = open64 (ARCHIVE_NAME, O_RDONLY);
++  fd = open64 (_write_archive_locales_path, O_RDONLY);
+   if (fd < 0)
+     return 0;
+ 
+@@ -700,8 +701,8 @@ write_archive_locales (void **all_datap,
+ 	  if (cnt)
+ 	    putchar_unlocked ('\n');
+ 
+-	  printf ("locale: %-15.15s archive: " ARCHIVE_NAME "\n%s\n",
+-		  names[cnt].name, linebuf);
++	  printf ("locale: %-15.15s archive: %s\n%s\n",
++		  names[cnt].name, _write_archive_locales_path, linebuf);
+ 
+ 	  locrec = (struct locrecent *) (addr + names[cnt].locrec_offset);
+ 
Signature · 1 line
2.25.0
#8 lore raw

Re: [PATCH 5/6] glibc: Update nativesdk locale relocation patch

Quoted 74 lines · Richard Purdie

The locale binary reported incorrect locale lists in relocated toolchains as some path references were not relocated by this patch. Fix this missing relocations so the locale binary correctly reports the locales.

---
  ...Make-relocatable-install-for-locales.patch | 62 ++++++++++++++-----
  1 file changed, 47 insertions(+), 15 deletions(-)
meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch +15 -15
index d9985c2fdc8..27cd17cdcdf 100644
@@ -17,11 +17,11 @@ Signed-off-by: Khem Raj <[email protected]>
   locale/localeinfo.h  | 2 +-
   3 files changed, 4 insertions(+), 4 deletions(-)
 
-diff --git a/locale/findlocale.c b/locale/findlocale.c
-index 9cd3b71a6d..84272310e0 100644
---- a/locale/findlocale.c
-+++ b/locale/findlocale.c
-@@ -56,7 +56,7 @@ struct __locale_data *const _nl_C[] attribute_hidden =
+Index: git/locale/findlocale.c
+===================================================================
+--- git.orig/locale/findlocale.c
++++ git/locale/findlocale.c
+@@ -56,7 +56,7 @@ struct __locale_data *const _nl_C[] attr
      which are somehow addressed.  */
   struct loaded_l10nfile *_nl_locale_file_list[__LC_LAST];
 
@@ -30,7 +30,7 @@ index 9cd3b71a6d..84272310e0 100644
 
   /* Checks if the name is actually present, that is, not NULL and not
      empty.  */
-@@ -166,7 +166,7 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
+@@ -166,7 +166,7 @@ _nl_find_locale (const char *locale_path
 
         /* Nothing in the archive.  Set the default path to search below.  */
         locale_path = _nl_default_locale_path;
@@ -39,10 +39,10 @@ index 9cd3b71a6d..84272310e0 100644
       }
     else
       /* We really have to load some data.  First see whether the name is
-diff --git a/locale/loadarchive.c b/locale/loadarchive.c
-index ba0fe45648..9737fd4cda 100644
---- a/locale/loadarchive.c
-+++ b/locale/loadarchive.c
+Index: git/locale/loadarchive.c
+===================================================================
+--- git.orig/locale/loadarchive.c
++++ git/locale/loadarchive.c
  @@ -42,7 +42,7 @@
 
 
@@ -52,11 +52,11 @@ index ba0fe45648..9737fd4cda 100644
 
   /* Size of initial mapping window, optimal if large enough to
      cover the header plus the initial locale.  */
-diff --git a/locale/localeinfo.h b/locale/localeinfo.h
-index 1bfe22aa7f..fdc283c69a 100644
---- a/locale/localeinfo.h
-+++ b/locale/localeinfo.h
-@@ -331,7 +331,7 @@ _nl_lookup_word (locale_t l, int category, int item)
+Index: git/locale/localeinfo.h
+===================================================================
+--- git.orig/locale/localeinfo.h
++++ git/locale/localeinfo.h
+@@ -331,7 +331,7 @@ _nl_lookup_word (locale_t l, int categor
   }
 
   /* Default search path if no LOCPATH environment variable.  */
@@ -65,3 +65,35 @@ index 1bfe22aa7f..fdc283c69a 100644
 
   /* Load the locale data for CATEGORY from the file specified by *NAME.

meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch index 1bfe22aa7f..fdc283c69a 100644 · line 76

Quoted 10 lines
meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch +9 -0
      If *NAME is "", use environment variables as specified by POSIX, and
+Index: git/locale/programs/locale.c
+===================================================================
+--- git.orig/locale/programs/locale.c
++++ git/locale/programs/locale.c
+@@ -632,6 +632,7 @@ nameentcmp (const void *a, const void *b
+ 		  ((const struct nameent *) b)->name);
+ }
+
++static char _write_archive_locales_path[4096] attribute_hidden __attribute__ ((section (".gccrelocprefix"))) = ARCHIVE_NAME;

is this .gccrelocprefix limited to nativesdk case in general ? I think this binds us into gcc quite a bit, so I would like to see if we can do it more generic ways which can work for say clang as well.

Quoted 24 lines
meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch +23 -0
+
+ static int
+ write_archive_locales (void **all_datap, char *linebuf)
+@@ -645,7 +646,7 @@ write_archive_locales (void **all_datap,
+   int fd, ret = 0;
+   uint32_t cnt;
+
+-  fd = open64 (ARCHIVE_NAME, O_RDONLY);
++  fd = open64 (_write_archive_locales_path, O_RDONLY);
+   if (fd < 0)
+     return 0;
+
+@@ -700,8 +701,8 @@ write_archive_locales (void **all_datap,
+ 	  if (cnt)
+ 	    putchar_unlocked ('\n');
+
+-	  printf ("locale: %-15.15s archive: " ARCHIVE_NAME "\n%s\n",
+-		  names[cnt].name, linebuf);
++	  printf ("locale: %-15.15s archive: %s\n%s\n",
++		  names[cnt].name, _write_archive_locales_path, linebuf);
+
+ 	  locrec = (struct locrecent *) (addr + names[cnt].locrec_offset);
+
#9 lore raw

PATCH 6/6 buildtools-extended-tarball: Add locale command

In reply to Richard Purdie

The eSDK installation code checks installed locales with the locale command which is from glibc-utils. Add this so that we find the correct locales from the buildtools.

---
 meta/recipes-core/meta/buildtools-extended-tarball.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-core/meta/buildtools-extended-tarball.bb +1 -0
index 4a79b09fda9..dd780c5d57e 100644
@@ -25,6 +25,7 @@ TOOLCHAIN_HOST_TASK += "\
     nativesdk-libstdc++-dev \
     nativesdk-libtool \
     nativesdk-pkgconfig \
+    nativesdk-glibc-utils \
     nativesdk-libxcrypt-dev \
     "
 
Signature · 1 line
2.25.0