[OE-core] [PATCH 5/6] glibc: Update nativesdk locale relocation patch

Khem Raj raj.khem at gmail.com
Wed Mar 11 17:40:38 UTC 2020



On 3/10/20 4:28 PM, Richard Purdie wrote:
> 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.
> 
> Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
> ---
>   ...Make-relocatable-install-for-locales.patch | 62 ++++++++++++++-----
>   1 file changed, 47 insertions(+), 15 deletions(-)
> 
> diff --git a/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch b/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch
> index d9985c2fdc8..27cd17cdcdf 100644
> --- a/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch
> +++ b/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch
> @@ -17,11 +17,11 @@ Signed-off-by: Khem Raj <raj.khem at gmail.com>
>    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;

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.

> +
> + 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);
> +
> 


More information about the Openembedded-core mailing list