diff --git a/.oebuild/manifest.yaml b/.oebuild/manifest.yaml index 73451673f39e62741241676c22749044105e12ba..73d66f8f57a1da7b343e4846cb9fc14b6c108eeb 100644 --- a/.oebuild/manifest.yaml +++ b/.oebuild/manifest.yaml @@ -1166,7 +1166,7 @@ manifest_list: version: 4fdd67497ed96fc717426b1be46fda564edd80f9 glibc: remote_url: https://gitee.com/src-openeuler/glibc.git - version: 55046a0afb74d71655cbb4120c6221ee03640717 + version: 10ebd73eb9a410787c84020a95862cb22160345f libXau: remote_url: https://gitee.com/src-openeuler/libXau.git version: 0dec19ac9813c179b6aa446e1dbfbd3864141a0f diff --git a/meta-openeuler/recipes-core/glibc/cross-localedef-native_%.bbappend b/meta-openeuler/recipes-core/glibc/cross-localedef-native_%.bbappend index 78a5ccac8a079a7cb47030bf40164a6af425ba26..ccb04480a3aaeed947a383c753dbb8360a13e250 100644 --- a/meta-openeuler/recipes-core/glibc/cross-localedef-native_%.bbappend +++ b/meta-openeuler/recipes-core/glibc/cross-localedef-native_%.bbappend @@ -6,8 +6,8 @@ OPENEULER_LOCAL_NAME = "glibc" FILESEXTRAPATHS:prepend := "${THISDIR}/files:" SRC_URI:prepend = " \ - file://glibc-2.38.tar.xz \ - file://localedef-master-e0eca29.zip \ + file://glibc-${PV}.tar.xz \ + git://github.com/kraj/localedef;branch=master;name=localedef;destsuffix=glibc-${PV}/localedef;protocol=https \ " SRC_URI:remove = " \ @@ -15,13 +15,4 @@ SRC_URI:remove = " \ git://github.com/kraj/localedef;branch=master;name=localedef;destsuffix=git/localedef;protocol=https \ " -S = "${WORKDIR}/glibc-2.38" - -do_unpack:append() { - bb.build.exec_func('do_copy_localedef_source', d) -} - -do_copy_localedef_source() { - mv ${WORKDIR}/localedef-master ${S}/localedef -} - +S = "${WORKDIR}/glibc-${PV}" diff --git a/meta-openeuler/recipes-core/glibc/cross-localedef-native_2.38.bb b/meta-openeuler/recipes-core/glibc/cross-localedef-native_2.38.bb deleted file mode 100644 index e7261a644bb2aa26453cfeb6ccf450bc394d9e87..0000000000000000000000000000000000000000 --- a/meta-openeuler/recipes-core/glibc/cross-localedef-native_2.38.bb +++ /dev/null @@ -1,54 +0,0 @@ -SUMMARY = "Cross locale generation tool for glibc" -HOMEPAGE = "http://www.gnu.org/software/libc/libc.html" -SECTION = "libs" -LICENSE = "LGPL-2.1-only" - -LIC_FILES_CHKSUM = "file://LICENSES;md5=1541fd8f5e8f1579512bf05f533371ba \ - file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \ - file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c" - -require glibc-version.inc - -# Tell autotools that we're working in the localedef directory -# -AUTOTOOLS_SCRIPT_PATH = "${S}/localedef" - -inherit autotools -inherit native - -FILESEXTRAPATHS =. "${FILE_DIRNAME}/${PN}:${FILE_DIRNAME}/glibc:" - -SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ - git://github.com/kraj/localedef;branch=master;name=localedef;destsuffix=git/localedef;protocol=https \ - \ - file://0001-localedef-Add-hardlink-resolver-from-util-linux.patch \ - file://0002-localedef-fix-ups-hardlink-to-make-it-compile.patch \ - \ - file://0010-eglibc-Cross-building-and-testing-instructions.patch \ - file://0011-eglibc-Help-bootstrap-cross-toolchain.patch \ - file://0012-eglibc-Resolve-__fpscr_values-on-SH4.patch \ - file://0013-eglibc-Forward-port-cross-locale-generation-support.patch \ - file://0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \ - file://0017-Replace-echo-with-printf-builtin-in-nscd-init-script.patch \ - file://0019-timezone-Make-shell-interpreter-overridable-in-tzsel.patch \ - " -# Makes for a rather long rev (22 characters), but... -# -SRCREV_FORMAT = "glibc_localedef" - -S = "${WORKDIR}/git" - -EXTRA_OECONF = "--with-glibc=${S}" - -# We do not need bash to run tzselect script, the default is to use -# bash but it can be configured by setting KSHELL Makefile variable -EXTRA_OEMAKE += "KSHELL=/bin/sh" - -CFLAGS += "-fgnu89-inline -std=gnu99 -DIS_IN\(x\)='0'" - -do_install() { - install -d ${D}${bindir} - install -m 0755 ${B}/localedef ${D}${bindir}/cross-localedef - install -m 0755 ${B}/cross-localedef-hardlink ${D}${bindir}/cross-localedef-hardlink -} diff --git a/meta-openeuler/recipes-core/glibc/files/0001-localedef-Add-hardlink-resolver-from-util-linux.patch b/meta-openeuler/recipes-core/glibc/files/0001-localedef-Add-hardlink-resolver-from-util-linux.patch deleted file mode 100644 index eb3da94b8ba0d686a13c3b62e51849ad71a6df00..0000000000000000000000000000000000000000 --- a/meta-openeuler/recipes-core/glibc/files/0001-localedef-Add-hardlink-resolver-from-util-linux.patch +++ /dev/null @@ -1,1130 +0,0 @@ -From 7c06ca59b47ce06f785b9fce7b9e9d675d5b6e10 Mon Sep 17 00:00:00 2001 -From: Jason Wessel -Date: Sat, 7 Dec 2019 09:59:22 -0800 -Subject: [PATCH] localedef: Add hardlink resolver from util-linux - -The hard link resolver that is built into localedef cannot be run in -parallel. It will search sibling directories (which are be processed -in parallel) and perform a creation of a .tmp file and remove the -original and move the .tmp file in. The problem is that if a probe -occurs a hard link can be requested to the file that is being removed. -This will lead to a stray copy or potentially, on a loaded system -cause race condition which pseudo cannot deal with, where it is left -with a hard link request to a file that no longer exists. In this -situation psuedo will inherit the permissions of what ever the target -inode had to offer. - -In short, there are two problems: - -1) You will be left with stray copies when using the hard link -resolution that is built in while running in parallel with -localedef. - -2) When running under pseudo the possibility exists for uid/gid -leakage when the source file is removed before the hard link can -be completed. - -The solution is to call localedef with --no-hard-links and separately -process the hardlinks at a later point. To do this requires the -inclusion of the hardlink utility found in modern versions of -util-linux. Most host systems do not have this, so it will be -included with the cross-localedef binary. - -[YOCTO #11299] -[YOCTO #12434] - -Upstream-Status: Pending - -Signed-off-by: Jason Wessel -Signed-off-by: Khem Raj ---- - locale/programs/c.h | 407 ++++++++++++++++ - locale/programs/cross-localedef-hardlink.c | 528 +++++++++++++++++++++ - locale/programs/xalloc.h | 129 +++++ - 3 files changed, 1064 insertions(+) - create mode 100644 locale/programs/c.h - create mode 100644 locale/programs/cross-localedef-hardlink.c - create mode 100644 locale/programs/xalloc.h - -diff --git a/locale/programs/c.h b/locale/programs/c.h -new file mode 100644 -index 0000000000..d0a402e90e ---- /dev/null -+++ b/locale/programs/c.h -@@ -0,0 +1,407 @@ -+/* -+ * Fundamental C definitions. -+ */ -+ -+#ifndef UTIL_LINUX_C_H -+#define UTIL_LINUX_C_H -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#ifdef HAVE_ERR_H -+# include -+#endif -+ -+#ifdef HAVE_SYS_SYSMACROS_H -+# include /* for major, minor */ -+#endif -+ -+#ifndef LOGIN_NAME_MAX -+# define LOGIN_NAME_MAX 256 -+#endif -+ -+#ifndef NAME_MAX -+# define NAME_MAX PATH_MAX -+#endif -+ -+/* -+ * __GNUC_PREREQ is deprecated in favour of __has_attribute() and -+ * __has_feature(). The __has macros are supported by clang and gcc>=5. -+ */ -+#ifndef __GNUC_PREREQ -+# if defined __GNUC__ && defined __GNUC_MINOR__ -+# define __GNUC_PREREQ(maj, min) \ -+ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) -+# else -+# define __GNUC_PREREQ(maj, min) 0 -+# endif -+#endif -+ -+#ifdef __GNUC__ -+ -+/* &a[0] degrades to a pointer: a different type from an array */ -+# define __must_be_array(a) \ -+ UL_BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(__typeof__(a), __typeof__(&a[0]))) -+ -+# define ignore_result(x) __extension__ ({ \ -+ __typeof__(x) __dummy __attribute__((__unused__)) = (x); (void) __dummy; \ -+}) -+ -+#else /* !__GNUC__ */ -+# define __must_be_array(a) 0 -+# define __attribute__(_arg_) -+# define ignore_result(x) ((void) (x)) -+#endif /* !__GNUC__ */ -+ -+/* -+ * It evaluates to 1 if the attribute/feature is supported by the current -+ * compilation targed. Fallback for old compilers. -+ */ -+#ifndef __has_attribute -+ #define __has_attribute(x) 0 -+#endif -+ -+#ifndef __has_feature -+ #define __has_feature(x) 0 -+#endif -+ -+/* -+ * Function attributes -+ */ -+#ifndef __ul_alloc_size -+# if (__has_attribute(alloc_size) && __has_attribute(warn_unused_result)) || __GNUC_PREREQ (4, 3) -+# define __ul_alloc_size(s) __attribute__((alloc_size(s), warn_unused_result)) -+# else -+# define __ul_alloc_size(s) -+# endif -+#endif -+ -+#ifndef __ul_calloc_size -+# if (__has_attribute(alloc_size) && __has_attribute(warn_unused_result)) || __GNUC_PREREQ (4, 3) -+# define __ul_calloc_size(n, s) __attribute__((alloc_size(n, s), warn_unused_result)) -+# else -+# define __ul_calloc_size(n, s) -+# endif -+#endif -+ -+#if __has_attribute(returns_nonnull) || __GNUC_PREREQ (4, 9) -+# define __ul_returns_nonnull __attribute__((returns_nonnull)) -+#else -+# define __ul_returns_nonnull -+#endif -+ -+/* -+ * Force a compilation error if condition is true, but also produce a -+ * result (of value 0 and type size_t), so the expression can be used -+ * e.g. in a structure initializer (or wherever else comma expressions -+ * aren't permitted). -+ */ -+#define UL_BUILD_BUG_ON_ZERO(e) __extension__ (sizeof(struct { int:-!!(e); })) -+#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); })) -+ -+#ifndef ARRAY_SIZE -+# define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) -+#endif -+ -+#ifndef PATH_MAX -+# define PATH_MAX 4096 -+#endif -+ -+#ifndef TRUE -+# define TRUE 1 -+#endif -+ -+#ifndef FALSE -+# define FALSE 0 -+#endif -+ -+#ifndef min -+# define min(x, y) __extension__ ({ \ -+ __typeof__(x) _min1 = (x); \ -+ __typeof__(y) _min2 = (y); \ -+ (void) (&_min1 == &_min2); \ -+ _min1 < _min2 ? _min1 : _min2; }) -+#endif -+ -+#ifndef max -+# define max(x, y) __extension__ ({ \ -+ __typeof__(x) _max1 = (x); \ -+ __typeof__(y) _max2 = (y); \ -+ (void) (&_max1 == &_max2); \ -+ _max1 > _max2 ? _max1 : _max2; }) -+#endif -+ -+#ifndef cmp_numbers -+# define cmp_numbers(x, y) __extension__ ({ \ -+ __typeof__(x) _a = (x); \ -+ __typeof__(y) _b = (y); \ -+ (void) (&_a == &_b); \ -+ _a == _b ? 0 : _a > _b ? 1 : -1; }) -+#endif -+ -+#ifndef offsetof -+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) -+#endif -+ -+/* -+ * container_of - cast a member of a structure out to the containing structure -+ * @ptr: the pointer to the member. -+ * @type: the type of the container struct this is embedded in. -+ * @member: the name of the member within the struct. -+ */ -+#ifndef container_of -+#define container_of(ptr, type, member) __extension__ ({ \ -+ const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \ -+ (type *)( (char *)__mptr - offsetof(type,member) );}) -+#endif -+ -+#ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME -+# ifdef HAVE___PROGNAME -+extern char *__progname; -+# define program_invocation_short_name __progname -+# else -+# ifdef HAVE_GETEXECNAME -+# define program_invocation_short_name \ -+ prog_inv_sh_nm_from_file(getexecname(), 0) -+# else -+# define program_invocation_short_name \ -+ prog_inv_sh_nm_from_file(__FILE__, 1) -+# endif -+static char prog_inv_sh_nm_buf[256]; -+static inline char * -+prog_inv_sh_nm_from_file(char *f, char stripext) -+{ -+ char *t; -+ -+ if ((t = strrchr(f, '/')) != NULL) -+ t++; -+ else -+ t = f; -+ -+ strncpy(prog_inv_sh_nm_buf, t, sizeof(prog_inv_sh_nm_buf) - 1); -+ prog_inv_sh_nm_buf[sizeof(prog_inv_sh_nm_buf) - 1] = '\0'; -+ -+ if (stripext && (t = strrchr(prog_inv_sh_nm_buf, '.')) != NULL) -+ *t = '\0'; -+ -+ return prog_inv_sh_nm_buf; -+} -+# endif -+#endif -+ -+ -+#ifndef HAVE_ERR_H -+static inline void -+errmsg(char doexit, int excode, char adderr, const char *fmt, ...) -+{ -+ fprintf(stderr, "%s: ", program_invocation_short_name); -+ if (fmt != NULL) { -+ va_list argp; -+ va_start(argp, fmt); -+ vfprintf(stderr, fmt, argp); -+ va_end(argp); -+ if (adderr) -+ fprintf(stderr, ": "); -+ } -+ if (adderr) -+ fprintf(stderr, "%m"); -+ fprintf(stderr, "\n"); -+ if (doexit) -+ exit(excode); -+} -+ -+#ifndef HAVE_ERR -+# define err(E, FMT...) errmsg(1, E, 1, FMT) -+#endif -+ -+#ifndef HAVE_ERRX -+# define errx(E, FMT...) errmsg(1, E, 0, FMT) -+#endif -+ -+#ifndef HAVE_WARN -+# define warn(FMT...) errmsg(0, 0, 1, FMT) -+#endif -+ -+#ifndef HAVE_WARNX -+# define warnx(FMT...) errmsg(0, 0, 0, FMT) -+#endif -+#endif /* !HAVE_ERR_H */ -+ -+ -+/* Don't use inline function to avoid '#include "nls.h"' in c.h -+ */ -+#define errtryhelp(eval) __extension__ ({ \ -+ fprintf(stderr, _("Try '%s --help' for more information.\n"), \ -+ program_invocation_short_name); \ -+ exit(eval); \ -+}) -+ -+/* After failed execvp() */ -+#define EX_EXEC_FAILED 126 /* Program located, but not usable. */ -+#define EX_EXEC_ENOENT 127 /* Could not find program to exec. */ -+#define errexec(name) err(errno == ENOENT ? EX_EXEC_ENOENT : EX_EXEC_FAILED, \ -+ _("failed to execute %s"), name) -+ -+ -+static inline __attribute__((const)) int is_power_of_2(unsigned long num) -+{ -+ return (num != 0 && ((num & (num - 1)) == 0)); -+} -+ -+#ifndef HAVE_LOFF_T -+typedef int64_t loff_t; -+#endif -+ -+#if !defined(HAVE_DIRFD) && (!defined(HAVE_DECL_DIRFD) || HAVE_DECL_DIRFD == 0) && defined(HAVE_DIR_DD_FD) -+#include -+#include -+static inline int dirfd(DIR *d) -+{ -+ return d->dd_fd; -+} -+#endif -+ -+/* -+ * Fallback defines for old versions of glibc -+ */ -+#include -+ -+#ifdef O_CLOEXEC -+#define UL_CLOEXECSTR "e" -+#else -+#define UL_CLOEXECSTR "" -+#endif -+ -+#ifndef O_CLOEXEC -+#define O_CLOEXEC 0 -+#endif -+ -+#ifdef __FreeBSD_kernel__ -+#ifndef F_DUPFD_CLOEXEC -+#define F_DUPFD_CLOEXEC 17 /* Like F_DUPFD, but FD_CLOEXEC is set */ -+#endif -+#endif -+ -+ -+#ifndef AI_ADDRCONFIG -+#define AI_ADDRCONFIG 0x0020 -+#endif -+ -+#ifndef IUTF8 -+#define IUTF8 0040000 -+#endif -+ -+/* -+ * MAXHOSTNAMELEN replacement -+ */ -+static inline size_t get_hostname_max(void) -+{ -+ long len = sysconf(_SC_HOST_NAME_MAX); -+ -+ if (0 < len) -+ return len; -+ -+#ifdef MAXHOSTNAMELEN -+ return MAXHOSTNAMELEN; -+#elif HOST_NAME_MAX -+ return HOST_NAME_MAX; -+#endif -+ return 64; -+} -+ -+ -+/* -+ * Constant strings for usage() functions. For more info see -+ * Documentation/{howto-usage-function.txt,boilerplate.c} -+ */ -+#define USAGE_HEADER ("\nUsage:\n") -+#define USAGE_OPTIONS ("\nOptions:\n") -+#define USAGE_FUNCTIONS ("\nFunctions:\n") -+#define USAGE_COMMANDS ("\nCommands:\n") -+#define USAGE_COLUMNS ("\nAvailable output columns:\n") -+#define USAGE_SEPARATOR "\n" -+ -+#define USAGE_OPTSTR_HELP ("display this help") -+#define USAGE_OPTSTR_VERSION ("display version") -+ -+#define USAGE_HELP_OPTIONS(marg_dsc) \ -+ "%-" #marg_dsc "s%s\n" \ -+ "%-" #marg_dsc "s%s\n" \ -+ , " -h, --help", USAGE_OPTSTR_HELP \ -+ , " -V, --version", USAGE_OPTSTR_VERSION -+ -+#define USAGE_MAN_TAIL(_man) ("\nFor more details see %s.\n"), _man -+ -+#define UTIL_LINUX_VERSION ("%s from %s\n"), program_invocation_short_name, PACKAGE_STRING -+ -+#define print_version(eval) __extension__ ({ \ -+ printf(UTIL_LINUX_VERSION); \ -+ exit(eval); \ -+}) -+ -+/* -+ * scanf modifiers for "strings allocation" -+ */ -+#ifdef HAVE_SCANF_MS_MODIFIER -+#define UL_SCNsA "%ms" -+#elif defined(HAVE_SCANF_AS_MODIFIER) -+#define UL_SCNsA "%as" -+#endif -+ -+/* -+ * seek stuff -+ */ -+#ifndef SEEK_DATA -+# define SEEK_DATA 3 -+#endif -+#ifndef SEEK_HOLE -+# define SEEK_HOLE 4 -+#endif -+ -+ -+/* -+ * Macros to convert #define'itions to strings, for example -+ * #define XYXXY 42 -+ * printf ("%s=%s\n", stringify(XYXXY), stringify_value(XYXXY)); -+ */ -+#define stringify_value(s) stringify(s) -+#define stringify(s) #s -+ -+/* -+ * UL_ASAN_BLACKLIST is a macro to tell AddressSanitizer (a compile-time -+ * instrumentation shipped with Clang and GCC) to not instrument the -+ * annotated function. Furthermore, it will prevent the compiler from -+ * inlining the function because inlining currently breaks the blacklisting -+ * mechanism of AddressSanitizer. -+ */ -+#if __has_feature(address_sanitizer) && __has_attribute(no_sanitize_memory) && __has_attribute(no_sanitize_address) -+# define UL_ASAN_BLACKLIST __attribute__((noinline)) __attribute__((no_sanitize_memory)) __attribute__((no_sanitize_address)) -+#else -+# define UL_ASAN_BLACKLIST /* nothing */ -+#endif -+ -+/* -+ * Note that sysconf(_SC_GETPW_R_SIZE_MAX) returns *initial* suggested size for -+ * pwd buffer and in some cases it is not large enough. See POSIX and -+ * getpwnam_r man page for more details. -+ */ -+#define UL_GETPW_BUFSIZ (16 * 1024) -+ -+/* -+ * Darwin or other BSDs may only have MAP_ANON. To get it on Darwin we must -+ * define _DARWIN_C_SOURCE before including sys/mman.h. We do this in config.h. -+ */ -+#if !defined MAP_ANONYMOUS && defined MAP_ANON -+# define MAP_ANONYMOUS (MAP_ANON) -+#endif -+ -+#endif /* UTIL_LINUX_C_H */ -diff --git a/locale/programs/cross-localedef-hardlink.c b/locale/programs/cross-localedef-hardlink.c -new file mode 100644 -index 0000000000..63615896b0 ---- /dev/null -+++ b/locale/programs/cross-localedef-hardlink.c -@@ -0,0 +1,528 @@ -+/* -+ * hardlink - consolidate duplicate files via hardlinks -+ * -+ * Copyright (C) 2018 Red Hat, Inc. All rights reserved. -+ * Written by Jakub Jelinek -+ * -+ * Copyright (C) 2019 Karel Zak -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it would be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License along -+ * with this program; if not, write to the Free Software Foundation, Inc., -+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+ */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#ifdef HAVE_PCRE -+# define PCRE2_CODE_UNIT_WIDTH 8 -+# include -+#endif -+ -+#include "c.h" -+#include "xalloc.h" -+#include "nls.h" -+#include "closestream.h" -+ -+#define NHASH (1<<17) /* Must be a power of 2! */ -+#define NBUF 64 -+ -+struct hardlink_file; -+ -+struct hardlink_hash { -+ struct hardlink_hash *next; -+ struct hardlink_file *chain; -+ off_t size; -+ time_t mtime; -+}; -+ -+struct hardlink_dir { -+ struct hardlink_dir *next; -+ char name[]; -+}; -+ -+struct hardlink_file { -+ struct hardlink_file *next; -+ ino_t ino; -+ dev_t dev; -+ unsigned int cksum; -+ char name[]; -+}; -+ -+struct hardlink_dynstr { -+ char *buf; -+ size_t alloc; -+}; -+ -+struct hardlink_ctl { -+ struct hardlink_dir *dirs; -+ struct hardlink_hash *hps[NHASH]; -+ char iobuf1[BUFSIZ]; -+ char iobuf2[BUFSIZ]; -+ /* summary counters */ -+ unsigned long long ndirs; -+ unsigned long long nobjects; -+ unsigned long long nregfiles; -+ unsigned long long ncomp; -+ unsigned long long nlinks; -+ unsigned long long nsaved; -+ /* current device */ -+ dev_t dev; -+ /* flags */ -+ unsigned int verbose; -+ unsigned int -+ no_link:1, -+ content_only:1, -+ force:1; -+}; -+/* ctl is in global scope due use in atexit() */ -+struct hardlink_ctl global_ctl; -+ -+__attribute__ ((always_inline)) -+static inline unsigned int hash(off_t size, time_t mtime) -+{ -+ return (size ^ mtime) & (NHASH - 1); -+} -+ -+__attribute__ ((always_inline)) -+static inline int stcmp(struct stat *st1, struct stat *st2, int content_scope) -+{ -+ if (content_scope) -+ return st1->st_size != st2->st_size; -+ -+ return st1->st_mode != st2->st_mode -+ || st1->st_uid != st2->st_uid -+ || st1->st_gid != st2->st_gid -+ || st1->st_size != st2->st_size -+ || st1->st_mtime != st2->st_mtime; -+} -+ -+static void print_summary(void) -+{ -+ struct hardlink_ctl const *const ctl = &global_ctl; -+ -+ if (!ctl->verbose) -+ return; -+ -+ if (ctl->verbose > 1 && ctl->nlinks) -+ fputc('\n', stdout); -+ -+ printf(_("Directories: %9lld\n"), ctl->ndirs); -+ printf(_("Objects: %9lld\n"), ctl->nobjects); -+ printf(_("Regular files: %9lld\n"), ctl->nregfiles); -+ printf(_("Comparisons: %9lld\n"), ctl->ncomp); -+ printf( "%s%9lld\n", (ctl->no_link ? -+ _("Would link: ") : -+ _("Linked: ")), ctl->nlinks); -+ printf( "%s %9lld\n", (ctl->no_link ? -+ _("Would save: ") : -+ _("Saved: ")), ctl->nsaved); -+} -+ -+static void __attribute__((__noreturn__)) usage(void) -+{ -+ fputs(USAGE_HEADER, stdout); -+ printf(_(" %s [options] directory...\n"), program_invocation_short_name); -+ -+ fputs(USAGE_SEPARATOR, stdout); -+ puts(_("Consolidate duplicate files using hardlinks.")); -+ -+ fputs(USAGE_OPTIONS, stdout); -+ puts(_(" -c, --content compare only contents, ignore permission, etc.")); -+ puts(_(" -n, --dry-run don't actually link anything")); -+ puts(_(" -v, --verbose print summary after hardlinking")); -+ puts(_(" -vv print every hardlinked file and summary")); -+ puts(_(" -f, --force force hardlinking across filesystems")); -+ puts(_(" -x, --exclude exclude files matching pattern")); -+ -+ fputs(USAGE_SEPARATOR, stdout); -+ printf(USAGE_HELP_OPTIONS(16)); /* char offset to align option descriptions */ -+ printf(USAGE_MAN_TAIL("hardlink(1)")); -+ exit(EXIT_SUCCESS); -+} -+ -+__attribute__ ((always_inline)) -+static inline size_t add2(size_t a, size_t b) -+{ -+ size_t sum = a + b; -+ -+ if (sum < a) -+ errx(EXIT_FAILURE, _("integer overflow")); -+ return sum; -+} -+ -+__attribute__ ((always_inline)) -+static inline size_t add3(size_t a, size_t b, size_t c) -+{ -+ return add2(add2(a, b), c); -+} -+ -+static void growstr(struct hardlink_dynstr *str, size_t newlen) -+{ -+ if (newlen < str->alloc) -+ return; -+ str->buf = xrealloc(str->buf, str->alloc = add2(newlen, 1)); -+} -+ -+static void process_path(struct hardlink_ctl *ctl, const char *name) -+{ -+ struct stat st, st2, st3; -+ const size_t namelen = strlen(name); -+ -+ ctl->nobjects++; -+ if (lstat(name, &st)) -+ return; -+ -+ if (st.st_dev != ctl->dev && !ctl->force) { -+ if (ctl->dev) -+ errx(EXIT_FAILURE, -+ _("%s is on different filesystem than the rest " -+ "(use -f option to override)."), name); -+ ctl->dev = st.st_dev; -+ } -+ if (S_ISDIR(st.st_mode)) { -+ struct hardlink_dir *dp = xmalloc(add3(sizeof(*dp), namelen, 1)); -+ memcpy(dp->name, name, namelen + 1); -+ dp->next = ctl->dirs; -+ ctl->dirs = dp; -+ -+ } else if (S_ISREG(st.st_mode)) { -+ int fd, i; -+ struct hardlink_file *fp, *fp2; -+ struct hardlink_hash *hp; -+ const char *n1, *n2; -+ unsigned int buf[NBUF]; -+ int cksumsize = sizeof(buf); -+ unsigned int cksum; -+ time_t mtime = ctl->content_only ? 0 : st.st_mtime; -+ unsigned int hsh = hash(st.st_size, mtime); -+ off_t fsize; -+ -+ ctl->nregfiles++; -+ if (ctl->verbose > 1) -+ printf("%s\n", name); -+ -+ fd = open(name, O_RDONLY); -+ if (fd < 0) -+ return; -+ -+ if ((size_t)st.st_size < sizeof(buf)) { -+ cksumsize = st.st_size; -+ memset(((char *)buf) + cksumsize, 0, -+ (sizeof(buf) - cksumsize) % sizeof(buf[0])); -+ } -+ if (read(fd, buf, cksumsize) != cksumsize) { -+ close(fd); -+ return; -+ } -+ cksumsize = (cksumsize + sizeof(buf[0]) - 1) / sizeof(buf[0]); -+ for (i = 0, cksum = 0; i < cksumsize; i++) { -+ if (cksum + buf[i] < cksum) -+ cksum += buf[i] + 1; -+ else -+ cksum += buf[i]; -+ } -+ for (hp = ctl->hps[hsh]; hp; hp = hp->next) { -+ if (hp->size == st.st_size && hp->mtime == mtime) -+ break; -+ } -+ if (!hp) { -+ hp = xmalloc(sizeof(*hp)); -+ hp->size = st.st_size; -+ hp->mtime = mtime; -+ hp->chain = NULL; -+ hp->next = ctl->hps[hsh]; -+ ctl->hps[hsh] = hp; -+ } -+ for (fp = hp->chain; fp; fp = fp->next) { -+ if (fp->cksum == cksum) -+ break; -+ } -+ for (fp2 = fp; fp2 && fp2->cksum == cksum; fp2 = fp2->next) { -+ if (fp2->ino == st.st_ino && fp2->dev == st.st_dev) { -+ close(fd); -+ return; -+ } -+ } -+ for (fp2 = fp; fp2 && fp2->cksum == cksum; fp2 = fp2->next) { -+ -+ if (!lstat(fp2->name, &st2) && S_ISREG(st2.st_mode) && -+ !stcmp(&st, &st2, ctl->content_only) && -+ st2.st_ino != st.st_ino && -+ st2.st_dev == st.st_dev) { -+ -+ int fd2 = open(fp2->name, O_RDONLY); -+ if (fd2 < 0) -+ continue; -+ -+ if (fstat(fd2, &st2) || !S_ISREG(st2.st_mode) -+ || st2.st_size == 0) { -+ close(fd2); -+ continue; -+ } -+ ctl->ncomp++; -+ lseek(fd, 0, SEEK_SET); -+ -+ for (fsize = st.st_size; fsize > 0; -+ fsize -= (off_t)sizeof(ctl->iobuf1)) { -+ ssize_t xsz; -+ ssize_t rsize = fsize > (ssize_t) sizeof(ctl->iobuf1) ? -+ (ssize_t) sizeof(ctl->iobuf1) : fsize; -+ -+ if ((xsz = read(fd, ctl->iobuf1, rsize)) != rsize) -+ warn(_("cannot read %s"), name); -+ else if ((xsz = read(fd2, ctl->iobuf2, rsize)) != rsize) -+ warn(_("cannot read %s"), fp2->name); -+ -+ if (xsz != rsize) { -+ close(fd); -+ close(fd2); -+ return; -+ } -+ if (memcmp(ctl->iobuf1, ctl->iobuf2, rsize)) -+ break; -+ } -+ close(fd2); -+ if (fsize > 0) -+ continue; -+ if (lstat(name, &st3)) { -+ warn(_("cannot stat %s"), name); -+ close(fd); -+ return; -+ } -+ st3.st_atime = st.st_atime; -+ if (stcmp(&st, &st3, 0)) { -+ warnx(_("file %s changed underneath us"), name); -+ close(fd); -+ return; -+ } -+ n1 = fp2->name; -+ n2 = name; -+ -+ if (!ctl->no_link) { -+ const char *suffix = -+ ".$$$___cleanit___$$$"; -+ const size_t suffixlen = strlen(suffix); -+ size_t n2len = strlen(n2); -+ struct hardlink_dynstr nam2 = { NULL, 0 }; -+ -+ growstr(&nam2, add2(n2len, suffixlen)); -+ memcpy(nam2.buf, n2, n2len); -+ memcpy(&nam2.buf[n2len], suffix, -+ suffixlen + 1); -+ /* First create a temporary link to n1 under a new name */ -+ if (link(n1, nam2.buf)) { -+ warn(_("failed to hardlink %s to %s (create temporary link as %s failed)"), -+ n1, n2, nam2.buf); -+ free(nam2.buf); -+ continue; -+ } -+ /* Then rename into place over the existing n2 */ -+ if (rename(nam2.buf, n2)) { -+ warn(_("failed to hardlink %s to %s (rename temporary link to %s failed)"), -+ n1, n2, n2); -+ /* Something went wrong, try to remove the now redundant temporary link */ -+ if (unlink(nam2.buf)) -+ warn(_("failed to remove temporary link %s"), nam2.buf); -+ free(nam2.buf); -+ continue; -+ } -+ free(nam2.buf); -+ } -+ ctl->nlinks++; -+ if (st3.st_nlink > 1) { -+ /* We actually did not save anything this time, since the link second argument -+ had some other links as well. */ -+ if (ctl->verbose > 1) -+ printf(_(" %s %s to %s\n"), -+ (ctl->no_link ? _("Would link") : _("Linked")), -+ n1, n2); -+ } else { -+ ctl->nsaved += ((st.st_size + 4095) / 4096) * 4096; -+ if (ctl->verbose > 1) -+ printf(_(" %s %s to %s, %s %jd\n"), -+ (ctl->no_link ? _("Would link") : _("Linked")), -+ n1, n2, -+ (ctl->no_link ? _("would save") : _("saved")), -+ (intmax_t)st.st_size); -+ } -+ close(fd); -+ return; -+ } -+ } -+ fp2 = xmalloc(add3(sizeof(*fp2), namelen, 1)); -+ close(fd); -+ fp2->ino = st.st_ino; -+ fp2->dev = st.st_dev; -+ fp2->cksum = cksum; -+ memcpy(fp2->name, name, namelen + 1); -+ -+ if (fp) { -+ fp2->next = fp->next; -+ fp->next = fp2; -+ } else { -+ fp2->next = hp->chain; -+ hp->chain = fp2; -+ } -+ return; -+ } -+} -+ -+int main(int argc, char **argv) -+{ -+ int ch; -+ int i; -+#ifdef HAVE_PCRE -+ int errornumber; -+ PCRE2_SIZE erroroffset; -+ pcre2_code *re = NULL; -+ PCRE2_SPTR exclude_pattern = NULL; -+ pcre2_match_data *match_data = NULL; -+#endif -+ struct hardlink_dynstr nam1 = { NULL, 0 }; -+ struct hardlink_ctl *ctl = &global_ctl; -+ -+ static const struct option longopts[] = { -+ { "content", no_argument, NULL, 'c' }, -+ { "dry-run", no_argument, NULL, 'n' }, -+ { "exclude", required_argument, NULL, 'x' }, -+ { "force", no_argument, NULL, 'f' }, -+ { "help", no_argument, NULL, 'h' }, -+ { "verbose", no_argument, NULL, 'v' }, -+ { "version", no_argument, NULL, 'V' }, -+ { NULL, 0, NULL, 0 }, -+ }; -+ -+ setlocale(LC_ALL, ""); -+ bindtextdomain(PACKAGE, LOCALEDIR); -+ textdomain(PACKAGE); -+ close_stdout_atexit(); -+ -+ while ((ch = getopt_long(argc, argv, "cnvfx:Vh", longopts, NULL)) != -1) { -+ switch (ch) { -+ case 'n': -+ ctl->no_link = 1; -+ break; -+ case 'v': -+ ctl->verbose++; -+ break; -+ case 'c': -+ ctl->content_only = 1; -+ break; -+ case 'f': -+ ctl->force = 1; -+ break; -+ case 'x': -+#ifdef HAVE_PCRE -+ exclude_pattern = (PCRE2_SPTR) optarg; -+#else -+ errx(EXIT_FAILURE, -+ _("option --exclude not supported (built without pcre2)")); -+#endif -+ break; -+ case 'V': -+ print_version(EXIT_SUCCESS); -+ case 'h': -+ usage(); -+ default: -+ errtryhelp(EXIT_FAILURE); -+ } -+ } -+ -+ if (optind == argc) { -+ warnx(_("no directory specified")); -+ errtryhelp(EXIT_FAILURE); -+ } -+ -+#ifdef HAVE_PCRE -+ if (exclude_pattern) { -+ re = pcre2_compile(exclude_pattern, /* the pattern */ -+ PCRE2_ZERO_TERMINATED, /* indicates pattern is zero-terminate */ -+ 0, /* default options */ -+ &errornumber, &erroroffset, NULL); /* use default compile context */ -+ if (!re) { -+ PCRE2_UCHAR buffer[256]; -+ pcre2_get_error_message(errornumber, buffer, -+ sizeof(buffer)); -+ errx(EXIT_FAILURE, _("pattern error at offset %d: %s"), -+ (int)erroroffset, buffer); -+ } -+ match_data = pcre2_match_data_create_from_pattern(re, NULL); -+ } -+#endif -+ atexit(print_summary); -+ -+ for (i = optind; i < argc; i++) -+ process_path(ctl, argv[i]); -+ -+ while (ctl->dirs) { -+ DIR *dh; -+ struct dirent *di; -+ struct hardlink_dir *dp = ctl->dirs; -+ size_t nam1baselen = strlen(dp->name); -+ -+ ctl->dirs = dp->next; -+ growstr(&nam1, add2(nam1baselen, 1)); -+ memcpy(nam1.buf, dp->name, nam1baselen); -+ free(dp); -+ nam1.buf[nam1baselen++] = '/'; -+ nam1.buf[nam1baselen] = 0; -+ dh = opendir(nam1.buf); -+ -+ if (dh == NULL) -+ continue; -+ ctl->ndirs++; -+ -+ while ((di = readdir(dh)) != NULL) { -+ if (!di->d_name[0]) -+ continue; -+ if (di->d_name[0] == '.') { -+ if (!di->d_name[1] || !strcmp(di->d_name, "..")) -+ continue; -+ } -+#ifdef HAVE_PCRE -+ if (re && pcre2_match(re, /* compiled regex */ -+ (PCRE2_SPTR) di->d_name, strlen(di->d_name), 0, /* start at offset 0 */ -+ 0, /* default options */ -+ match_data, /* block for storing the result */ -+ NULL) /* use default match context */ -+ >=0) { -+ if (ctl->verbose) { -+ nam1.buf[nam1baselen] = 0; -+ printf(_("Skipping %s%s\n"), nam1.buf, di->d_name); -+ } -+ continue; -+ } -+#endif -+ { -+ size_t subdirlen; -+ growstr(&nam1, -+ add2(nam1baselen, subdirlen = -+ strlen(di->d_name))); -+ memcpy(&nam1.buf[nam1baselen], di->d_name, -+ add2(subdirlen, 1)); -+ } -+ process_path(ctl, nam1.buf); -+ } -+ closedir(dh); -+ } -+ -+ return 0; -+} -diff --git a/locale/programs/xalloc.h b/locale/programs/xalloc.h -new file mode 100644 -index 0000000000..0129a85e2e ---- /dev/null -+++ b/locale/programs/xalloc.h -@@ -0,0 +1,129 @@ -+/* -+ * Copyright (C) 2010 Davidlohr Bueso -+ * -+ * This file may be redistributed under the terms of the -+ * GNU Lesser General Public License. -+ * -+ * General memory allocation wrappers for malloc, realloc, calloc and strdup -+ */ -+ -+#ifndef UTIL_LINUX_XALLOC_H -+#define UTIL_LINUX_XALLOC_H -+ -+#include -+#include -+ -+#include "c.h" -+ -+#ifndef XALLOC_EXIT_CODE -+# define XALLOC_EXIT_CODE EXIT_FAILURE -+#endif -+ -+static inline void __attribute__((__noreturn__)) -+__err_oom(const char *file, unsigned int line) -+{ -+ err(XALLOC_EXIT_CODE, "%s: %u: cannot allocate memory", file, line); -+} -+ -+#define err_oom() __err_oom(__FILE__, __LINE__) -+ -+static inline __ul_alloc_size(1) __ul_returns_nonnull -+void *xmalloc(const size_t size) -+{ -+ void *ret = malloc(size); -+ -+ if (!ret && size) -+ err(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size); -+ return ret; -+} -+ -+static inline __ul_alloc_size(2) __ul_returns_nonnull -+void *xrealloc(void *ptr, const size_t size) -+{ -+ void *ret = realloc(ptr, size); -+ -+ if (!ret && size) -+ err(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size); -+ return ret; -+} -+ -+static inline __ul_calloc_size(1, 2) __ul_returns_nonnull -+void *xcalloc(const size_t nelems, const size_t size) -+{ -+ void *ret = calloc(nelems, size); -+ -+ if (!ret && size && nelems) -+ err(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size); -+ return ret; -+} -+ -+static inline char __attribute__((warn_unused_result)) __ul_returns_nonnull -+*xstrdup(const char *str) -+{ -+ char *ret; -+ -+ if (!str) -+ return NULL; -+ -+ ret = strdup(str); -+ -+ if (!ret) -+ err(XALLOC_EXIT_CODE, "cannot duplicate string"); -+ return ret; -+} -+ -+static inline char * __attribute__((warn_unused_result)) __ul_returns_nonnull -+xstrndup(const char *str, size_t size) -+{ -+ char *ret; -+ -+ if (!str) -+ return NULL; -+ -+ ret = strndup(str, size); -+ -+ if (!ret) -+ err(XALLOC_EXIT_CODE, "cannot duplicate string"); -+ return ret; -+} -+ -+ -+static inline int __attribute__ ((__format__(printf, 2, 3))) -+ xasprintf(char **strp, const char *fmt, ...) -+{ -+ int ret; -+ va_list args; -+ va_start(args, fmt); -+ ret = vasprintf(&(*strp), fmt, args); -+ va_end(args); -+ if (ret < 0) -+ err(XALLOC_EXIT_CODE, "cannot allocate string"); -+ return ret; -+} -+ -+static inline int __attribute__ ((__format__(printf, 2, 0))) -+xvasprintf(char **strp, const char *fmt, va_list ap) -+{ -+ int ret = vasprintf(&(*strp), fmt, ap); -+ if (ret < 0) -+ err(XALLOC_EXIT_CODE, "cannot allocate string"); -+ return ret; -+} -+ -+ -+static inline char * __attribute__((warn_unused_result)) xgethostname(void) -+{ -+ char *name; -+ size_t sz = get_hostname_max() + 1; -+ -+ name = xmalloc(sizeof(char) * sz); -+ -+ if (gethostname(name, sz) != 0) { -+ free(name); -+ return NULL; -+ } -+ name[sz - 1] = '\0'; -+ return name; -+} -+ -+#endif diff --git a/meta-openeuler/recipes-core/glibc/files/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch b/meta-openeuler/recipes-core/glibc/files/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch deleted file mode 100644 index 2dc4634dd5cb8484c9a6a42e443d491968751e50..0000000000000000000000000000000000000000 --- a/meta-openeuler/recipes-core/glibc/files/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch +++ /dev/null @@ -1,238 +0,0 @@ -From 9ff5200eb16e9c89ca8da89d7e07975d082a13b0 Mon Sep 17 00:00:00 2001 -From: Jason Wessel -Date: Sat, 7 Dec 2019 10:01:37 -0800 -Subject: [PATCH] localedef: fix-ups hardlink to make it compile - -Upstream-Status: Pending -Signed-off-by: Jason Wessel -Signed-off-by: Khem Raj ---- - locale/programs/c.h | 2 +- - locale/programs/cross-localedef-hardlink.c | 79 +++++++++++----------- - 2 files changed, 39 insertions(+), 42 deletions(-) - -diff --git a/locale/programs/c.h b/locale/programs/c.h -index d0a402e90e..1804d31c73 100644 ---- a/locale/programs/c.h -+++ b/locale/programs/c.h -@@ -240,7 +240,7 @@ errmsg(char doexit, int excode, char adderr, const char *fmt, ...) - /* Don't use inline function to avoid '#include "nls.h"' in c.h - */ - #define errtryhelp(eval) __extension__ ({ \ -- fprintf(stderr, _("Try '%s --help' for more information.\n"), \ -+ fprintf(stderr, ("Try '%s --help' for more information.\n"), \ - program_invocation_short_name); \ - exit(eval); \ - }) -diff --git a/locale/programs/cross-localedef-hardlink.c b/locale/programs/cross-localedef-hardlink.c -index 63615896b0..726e6dd948 100644 ---- a/locale/programs/cross-localedef-hardlink.c -+++ b/locale/programs/cross-localedef-hardlink.c -@@ -20,6 +20,8 @@ - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -+ -+#undef HAVE_PCRE - #include - #include - #include -@@ -38,8 +40,8 @@ - - #include "c.h" - #include "xalloc.h" --#include "nls.h" --#include "closestream.h" -+//#include "nls.h" -+//#include "closestream.h" - - #define NHASH (1<<17) /* Must be a power of 2! */ - #define NBUF 64 -@@ -124,33 +126,33 @@ static void print_summary(void) - if (ctl->verbose > 1 && ctl->nlinks) - fputc('\n', stdout); - -- printf(_("Directories: %9lld\n"), ctl->ndirs); -- printf(_("Objects: %9lld\n"), ctl->nobjects); -- printf(_("Regular files: %9lld\n"), ctl->nregfiles); -- printf(_("Comparisons: %9lld\n"), ctl->ncomp); -+ printf(("Directories: %9lld\n"), ctl->ndirs); -+ printf(("Objects: %9lld\n"), ctl->nobjects); -+ printf(("Regular files: %9lld\n"), ctl->nregfiles); -+ printf(("Comparisons: %9lld\n"), ctl->ncomp); - printf( "%s%9lld\n", (ctl->no_link ? -- _("Would link: ") : -- _("Linked: ")), ctl->nlinks); -+ ("Would link: ") : -+ ("Linked: ")), ctl->nlinks); - printf( "%s %9lld\n", (ctl->no_link ? -- _("Would save: ") : -- _("Saved: ")), ctl->nsaved); -+ ("Would save: ") : -+ ("Saved: ")), ctl->nsaved); - } - - static void __attribute__((__noreturn__)) usage(void) - { - fputs(USAGE_HEADER, stdout); -- printf(_(" %s [options] directory...\n"), program_invocation_short_name); -+ printf((" %s [options] directory...\n"), program_invocation_short_name); - - fputs(USAGE_SEPARATOR, stdout); -- puts(_("Consolidate duplicate files using hardlinks.")); -+ puts(("Consolidate duplicate files using hardlinks.")); - - fputs(USAGE_OPTIONS, stdout); -- puts(_(" -c, --content compare only contents, ignore permission, etc.")); -- puts(_(" -n, --dry-run don't actually link anything")); -- puts(_(" -v, --verbose print summary after hardlinking")); -- puts(_(" -vv print every hardlinked file and summary")); -- puts(_(" -f, --force force hardlinking across filesystems")); -- puts(_(" -x, --exclude exclude files matching pattern")); -+ puts((" -c, --content compare only contents, ignore permission, etc.")); -+ puts((" -n, --dry-run don't actually link anything")); -+ puts((" -v, --verbose print summary after hardlinking")); -+ puts((" -vv print every hardlinked file and summary")); -+ puts((" -f, --force force hardlinking across filesystems")); -+ puts((" -x, --exclude exclude files matching pattern")); - - fputs(USAGE_SEPARATOR, stdout); - printf(USAGE_HELP_OPTIONS(16)); /* char offset to align option descriptions */ -@@ -164,7 +166,7 @@ static inline size_t add2(size_t a, size_t b) - size_t sum = a + b; - - if (sum < a) -- errx(EXIT_FAILURE, _("integer overflow")); -+ errx(EXIT_FAILURE, ("integer overflow")); - return sum; - } - -@@ -193,7 +195,7 @@ static void process_path(struct hardlink_ctl *ctl, const char *name) - if (st.st_dev != ctl->dev && !ctl->force) { - if (ctl->dev) - errx(EXIT_FAILURE, -- _("%s is on different filesystem than the rest " -+ ("%s is on different filesystem than the rest " - "(use -f option to override)."), name); - ctl->dev = st.st_dev; - } -@@ -287,9 +289,9 @@ static void process_path(struct hardlink_ctl *ctl, const char *name) - (ssize_t) sizeof(ctl->iobuf1) : fsize; - - if ((xsz = read(fd, ctl->iobuf1, rsize)) != rsize) -- warn(_("cannot read %s"), name); -+ warn(("cannot read %s"), name); - else if ((xsz = read(fd2, ctl->iobuf2, rsize)) != rsize) -- warn(_("cannot read %s"), fp2->name); -+ warn(("cannot read %s"), fp2->name); - - if (xsz != rsize) { - close(fd); -@@ -303,13 +305,13 @@ static void process_path(struct hardlink_ctl *ctl, const char *name) - if (fsize > 0) - continue; - if (lstat(name, &st3)) { -- warn(_("cannot stat %s"), name); -+ warn(("cannot stat %s"), name); - close(fd); - return; - } - st3.st_atime = st.st_atime; - if (stcmp(&st, &st3, 0)) { -- warnx(_("file %s changed underneath us"), name); -+ warnx(("file %s changed underneath us"), name); - close(fd); - return; - } -@@ -329,18 +331,18 @@ static void process_path(struct hardlink_ctl *ctl, const char *name) - suffixlen + 1); - /* First create a temporary link to n1 under a new name */ - if (link(n1, nam2.buf)) { -- warn(_("failed to hardlink %s to %s (create temporary link as %s failed)"), -+ warn(("failed to hardlink %s to %s (create temporary link as %s failed)"), - n1, n2, nam2.buf); - free(nam2.buf); - continue; - } - /* Then rename into place over the existing n2 */ - if (rename(nam2.buf, n2)) { -- warn(_("failed to hardlink %s to %s (rename temporary link to %s failed)"), -+ warn(("failed to hardlink %s to %s (rename temporary link to %s failed)"), - n1, n2, n2); - /* Something went wrong, try to remove the now redundant temporary link */ - if (unlink(nam2.buf)) -- warn(_("failed to remove temporary link %s"), nam2.buf); -+ warn(("failed to remove temporary link %s"), nam2.buf); - free(nam2.buf); - continue; - } -@@ -351,16 +353,16 @@ static void process_path(struct hardlink_ctl *ctl, const char *name) - /* We actually did not save anything this time, since the link second argument - had some other links as well. */ - if (ctl->verbose > 1) -- printf(_(" %s %s to %s\n"), -- (ctl->no_link ? _("Would link") : _("Linked")), -+ printf((" %s %s to %s\n"), -+ (ctl->no_link ? ("Would link") : ("Linked")), - n1, n2); - } else { - ctl->nsaved += ((st.st_size + 4095) / 4096) * 4096; - if (ctl->verbose > 1) -- printf(_(" %s %s to %s, %s %jd\n"), -- (ctl->no_link ? _("Would link") : _("Linked")), -+ printf((" %s %s to %s, %s %jd\n"), -+ (ctl->no_link ? ("Would link") : ("Linked")), - n1, n2, -- (ctl->no_link ? _("would save") : _("saved")), -+ (ctl->no_link ? ("would save") : ("saved")), - (intmax_t)st.st_size); - } - close(fd); -@@ -410,11 +412,6 @@ int main(int argc, char **argv) - { NULL, 0, NULL, 0 }, - }; - -- setlocale(LC_ALL, ""); -- bindtextdomain(PACKAGE, LOCALEDIR); -- textdomain(PACKAGE); -- close_stdout_atexit(); -- - while ((ch = getopt_long(argc, argv, "cnvfx:Vh", longopts, NULL)) != -1) { - switch (ch) { - case 'n': -@@ -434,7 +431,7 @@ int main(int argc, char **argv) - exclude_pattern = (PCRE2_SPTR) optarg; - #else - errx(EXIT_FAILURE, -- _("option --exclude not supported (built without pcre2)")); -+ ("option --exclude not supported (built without pcre2)")); - #endif - break; - case 'V': -@@ -447,7 +444,7 @@ int main(int argc, char **argv) - } - - if (optind == argc) { -- warnx(_("no directory specified")); -+ warnx(("no directory specified")); - errtryhelp(EXIT_FAILURE); - } - -@@ -461,7 +458,7 @@ int main(int argc, char **argv) - PCRE2_UCHAR buffer[256]; - pcre2_get_error_message(errornumber, buffer, - sizeof(buffer)); -- errx(EXIT_FAILURE, _("pattern error at offset %d: %s"), -+ errx(EXIT_FAILURE, ("pattern error at offset %d: %s"), - (int)erroroffset, buffer); - } - match_data = pcre2_match_data_create_from_pattern(re, NULL); -@@ -506,7 +503,7 @@ int main(int argc, char **argv) - >=0) { - if (ctl->verbose) { - nam1.buf[nam1baselen] = 0; -- printf(_("Skipping %s%s\n"), nam1.buf, di->d_name); -+ printf(("Skipping %s%s\n"), nam1.buf, di->d_name); - } - continue; - } diff --git a/meta-openeuler/recipes-core/glibc/files/0010-eglibc-Cross-building-and-testing-instructions.patch b/meta-openeuler/recipes-core/glibc/files/0010-eglibc-Cross-building-and-testing-instructions.patch deleted file mode 100644 index ffbe138ff1c814fa75e950d93e272339a850d52c..0000000000000000000000000000000000000000 --- a/meta-openeuler/recipes-core/glibc/files/0010-eglibc-Cross-building-and-testing-instructions.patch +++ /dev/null @@ -1,616 +0,0 @@ -From 9625e90bdf35774c71f1e566e73d435e38c04171 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Wed, 18 Mar 2015 00:42:58 +0000 -Subject: [PATCH] eglibc: Cross building and testing instructions - -Ported from eglibc -Upstream-Status: Pending - -Signed-off-by: Khem Raj ---- - GLIBC.cross-building | 383 +++++++++++++++++++++++++++++++++++++++++++ - GLIBC.cross-testing | 205 +++++++++++++++++++++++ - 2 files changed, 588 insertions(+) - create mode 100644 GLIBC.cross-building - create mode 100644 GLIBC.cross-testing - -diff --git a/GLIBC.cross-building b/GLIBC.cross-building -new file mode 100644 -index 0000000000..e6e0da1aaf ---- /dev/null -+++ b/GLIBC.cross-building -@@ -0,0 +1,383 @@ -+ -*- mode: text -*- -+ -+ Cross-Compiling GLIBC -+ Jim Blandy -+ -+ -+Introduction -+ -+Most GNU tools have a simple build procedure: you run their -+'configure' script, and then you run 'make'. Unfortunately, the -+process of cross-compiling the GNU C library is quite a bit more -+involved: -+ -+1) Build a cross-compiler, with certain facilities disabled. -+ -+2) Configure the C library using the compiler you built in step 1). -+ Build a few of the C run-time object files, but not the rest of the -+ library. Install the library's header files and the run-time -+ object files, and create a dummy libc.so. -+ -+3) Build a second cross-compiler, using the header files and object -+ files you installed in step 2. -+ -+4) Configure, build, and install a fresh C library, using the compiler -+ built in step 3. -+ -+5) Build a third cross-compiler, based on the C library built in step 4. -+ -+The reason for this complexity is that, although GCC and the GNU C -+library are distributed separately, they are not actually independent -+of each other: GCC requires the C library's headers and some object -+files to compile its own libraries, while the C library depends on -+GCC's libraries. GLIBC includes features and bug fixes to the stock -+GNU C library that simplify this process, but the fundamental -+interdependency stands. -+ -+In this document, we explain how to cross-compile an GLIBC/GCC pair -+from source. Our intended audience is developers who are already -+familiar with the GNU toolchain and comfortable working with -+cross-development tools. While we do present a worked example to -+accompany the explanation, for clarity's sake we do not cover many of -+the options available to cross-toolchain users. -+ -+ -+Preparation -+ -+GLIBC requires recent versions of the GNU binutils, GCC, and the -+Linux kernel. The web page -+documents the current requirements, and lists patches needed for -+certain target architectures. As of this writing, these build -+instructions have been tested with binutils 2.22.51, GCC 4.6.2, -+and Linux 3.1. -+ -+First, let's set some variables, to simplify later commands. We'll -+build GLIBC and GCC for an ARM target, known to the Linux kernel -+as 'arm', and we'll do the build on an Intel x86_64 Linux box: -+ -+ $ build=x86_64-pc-linux-gnu -+ $ host=$build -+ $ target=arm-none-linux-gnueabi -+ $ linux_arch=arm -+ -+We're using the aforementioned versions of Binutils, GCC, and Linux: -+ -+ $ binutilsv=binutils-2.22.51 -+ $ gccv=gcc-4.6.2 -+ $ linuxv=linux-3.1 -+ -+We're carrying out the entire process under '~/cross-build', which -+contains unpacked source trees for binutils, gcc, and linux kernel, -+along with GLIBC svn trunk (which can be checked-out with -+'svn co http://www.eglibc.org/svn/trunk eglibc'): -+ -+ $ top=$HOME/cross-build/$target -+ $ src=$HOME/cross-build/src -+ $ ls $src -+ binutils-2.22.51 glibc gcc-4.6.2 linux-3.1 -+ -+We're going to place our build directories in a subdirectory 'obj', -+we'll install the cross-development toolchain in 'tools', and we'll -+place our sysroot (containing files to be installed on the target -+system) in 'sysroot': -+ -+ $ obj=$top/obj -+ $ tools=$top/tools -+ $ sysroot=$top/sysroot -+ -+ -+Binutils -+ -+Configuring and building binutils for the target is straightforward: -+ -+ $ mkdir -p $obj/binutils -+ $ cd $obj/binutils -+ $ $src/$binutilsv/configure \ -+ > --target=$target \ -+ > --prefix=$tools \ -+ > --with-sysroot=$sysroot -+ $ make -+ $ make install -+ -+ -+The First GCC -+ -+For our work, we need a cross-compiler targeting an ARM Linux -+system. However, that configuration includes the shared library -+'libgcc_s.so', which is compiled against the GLIBC headers (which we -+haven't installed yet) and linked against 'libc.so' (which we haven't -+built yet). -+ -+Fortunately, there are configuration options for GCC which tell it not -+to build 'libgcc_s.so'. The '--without-headers' option is supposed to -+take care of this, but its implementation is incomplete, so you must -+also configure with the '--with-newlib' option. While '--with-newlib' -+appears to mean "Use the Newlib C library", its effect is to tell the -+GCC build machinery, "Don't assume there is a C library available." -+ -+We also need to disable some of the libraries that would normally be -+built along with GCC, and specify that only the compiler for the C -+language is needed. -+ -+So, we create a build directory, configure, make, and install. -+ -+ $ mkdir -p $obj/gcc1 -+ $ cd $obj/gcc1 -+ $ $src/$gccv/configure \ -+ > --target=$target \ -+ > --prefix=$tools \ -+ > --without-headers --with-newlib \ -+ > --disable-shared --disable-threads --disable-libssp \ -+ > --disable-libgomp --disable-libmudflap --disable-libquadmath \ -+ > --disable-decimal-float --disable-libffi \ -+ > --enable-languages=c -+ $ PATH=$tools/bin:$PATH make -+ $ PATH=$tools/bin:$PATH make install -+ -+ -+Linux Kernel Headers -+ -+To configure GLIBC, we also need Linux kernel headers in place. -+Fortunately, the Linux makefiles have a target that installs them for -+us. Since the process does modify the source tree a bit, we make a -+copy first: -+ -+ $ cp -r $src/$linuxv $obj/linux -+ $ cd $obj/linux -+ -+Now we're ready to install the headers into the sysroot: -+ -+ $ PATH=$tools/bin:$PATH \ -+ > make headers_install \ -+ > ARCH=$linux_arch CROSS_COMPILE=$target- \ -+ > INSTALL_HDR_PATH=$sysroot/usr -+ -+ -+GLIBC Headers and Preliminary Objects -+ -+Using the cross-compiler we've just built, we can now configure GLIBC -+well enough to install the headers and build the object files that the -+full cross-compiler will need: -+ -+ $ mkdir -p $obj/glibc-headers -+ $ cd $obj/glibc-headers -+ $ BUILD_CC=gcc \ -+ > CC=$tools/bin/$target-gcc \ -+ > CXX=$tools/bin/$target-g++ \ -+ > AR=$tools/bin/$target-ar \ -+ > RANLIB=$tools/bin/$target-ranlib \ -+ > $src/glibc/libc/configure \ -+ > --prefix=/usr \ -+ > --with-headers=$sysroot/usr/include \ -+ > --build=$build \ -+ > --host=$target \ -+ > --disable-profile --without-gd --without-cvs \ -+ > --enable-add-ons=nptl,libidn,../ports -+ -+The option '--prefix=/usr' may look strange, but you should never -+configure GLIBC with a prefix other than '/usr': in various places, -+GLIBC's build system checks whether the prefix is '/usr', and does -+special handling only if that is the case. Unless you use this -+prefix, you will get a sysroot that does not use the standard Linux -+directory layouts and cannot be used as a basis for the root -+filesystem on your target system compatibly with normal GLIBC -+installations. -+ -+The '--with-headers' option tells GLIBC where the Linux headers have -+been installed. -+ -+The '--enable-add-ons=nptl,libidn,../ports' option tells GLIBC to look -+for the listed glibc add-ons. Most notably the ports add-on (located -+just above the libc sources in the GLIBC svn tree) is required to -+support ARM targets. -+ -+We can now use the 'install-headers' makefile target to install the -+headers: -+ -+ $ make install-headers install_root=$sysroot \ -+ > install-bootstrap-headers=yes -+ -+The 'install_root' variable indicates where the files should actually -+be installed; its value is treated as the parent of the '--prefix' -+directory we passed to the configure script, so the headers will go in -+'$sysroot/usr/include'. The 'install-bootstrap-headers' variable -+requests special handling for certain tricky header files. -+ -+Next, there are a few object files needed to link shared libraries, -+which we build and install by hand: -+ -+ $ mkdir -p $sysroot/usr/lib -+ $ make csu/subdir_lib -+ $ cp csu/crt1.o csu/crti.o csu/crtn.o $sysroot/usr/lib -+ -+Finally, 'libgcc_s.so' requires a 'libc.so' to link against. However, -+since we will never actually execute its code, it doesn't matter what -+it contains. So, treating '/dev/null' as a C source file, we produce -+a dummy 'libc.so' in one step: -+ -+ $ $tools/bin/$target-gcc -nostdlib -nostartfiles -shared -x c /dev/null \ -+ > -o $sysroot/usr/lib/libc.so -+ -+ -+The Second GCC -+ -+With the GLIBC headers and selected object files installed, we can -+now build a GCC that is capable of compiling GLIBC. We configure, -+build, and install the second GCC, again building only the C compiler, -+and avoiding libraries we won't use: -+ -+ $ mkdir -p $obj/gcc2 -+ $ cd $obj/gcc2 -+ $ $src/$gccv/configure \ -+ > --target=$target \ -+ > --prefix=$tools \ -+ > --with-sysroot=$sysroot \ -+ > --disable-libssp --disable-libgomp --disable-libmudflap \ -+ > --disable-libffi --disable-libquadmath \ -+ > --enable-languages=c -+ $ PATH=$tools/bin:$PATH make -+ $ PATH=$tools/bin:$PATH make install -+ -+ -+GLIBC, Complete -+ -+With the second compiler built and installed, we're now ready for the -+full GLIBC build: -+ -+ $ mkdir -p $obj/glibc -+ $ cd $obj/glibc -+ $ BUILD_CC=gcc \ -+ > CC=$tools/bin/$target-gcc \ -+ > CXX=$tools/bin/$target-g++ \ -+ > AR=$tools/bin/$target-ar \ -+ > RANLIB=$tools/bin/$target-ranlib \ -+ > $src/glibc/libc/configure \ -+ > --prefix=/usr \ -+ > --with-headers=$sysroot/usr/include \ -+ > --with-kconfig=$obj/linux/scripts/kconfig \ -+ > --build=$build \ -+ > --host=$target \ -+ > --disable-profile --without-gd --without-cvs \ -+ > --enable-add-ons=nptl,libidn,../ports -+ -+Note the additional '--with-kconfig' option. This tells GLIBC where to -+find the host config tools used by the kernel 'make config' and 'make -+menuconfig'. These tools can be re-used by GLIBC for its own 'make -+*config' support, which will create 'option-groups.config' for you. -+But first make sure those tools have been built by running some -+dummy 'make *config' calls in the kernel directory: -+ -+ $ cd $obj/linux -+ $ PATH=$tools/bin:$PATH make config \ -+ > ARCH=$linux_arch CROSS_COMPILE=$target- \ -+ $ PATH=$tools/bin:$PATH make menuconfig \ -+ > ARCH=$linux_arch CROSS_COMPILE=$target- \ -+ -+Now we can configure and build the full GLIBC: -+ -+ $ cd $obj/glibc -+ $ PATH=$tools/bin:$PATH make defconfig -+ $ PATH=$tools/bin:$PATH make menuconfig -+ $ PATH=$tools/bin:$PATH make -+ $ PATH=$tools/bin:$PATH make install install_root=$sysroot -+ -+At this point, we have a complete GLIBC installation in '$sysroot', -+with header files, library files, and most of the C runtime startup -+files in place. -+ -+ -+The Third GCC -+ -+Finally, we recompile GCC against this full installation, enabling -+whatever languages and libraries we would like to use: -+ -+ $ mkdir -p $obj/gcc3 -+ $ cd $obj/gcc3 -+ $ $src/$gccv/configure \ -+ > --target=$target \ -+ > --prefix=$tools \ -+ > --with-sysroot=$sysroot \ -+ > --enable-__cxa_atexit \ -+ > --disable-libssp --disable-libgomp --disable-libmudflap \ -+ > --enable-languages=c,c++ -+ $ PATH=$tools/bin:$PATH make -+ $ PATH=$tools/bin:$PATH make install -+ -+The '--enable-__cxa_atexit' option tells GCC what sort of C++ -+destructor support to expect from the C library; it's required with -+GLIBC. -+ -+And since GCC's installation process isn't designed to help construct -+sysroot trees, we must manually copy certain libraries into place in -+the sysroot. -+ -+ $ cp -d $tools/$target/lib/libgcc_s.so* $sysroot/lib -+ $ cp -d $tools/$target/lib/libstdc++.so* $sysroot/usr/lib -+ -+ -+Trying Things Out -+ -+At this point, '$tools' contains a cross toolchain ready to use -+the GLIBC installation in '$sysroot': -+ -+ $ cat > hello.c < #include -+ > int -+ > main (int argc, char **argv) -+ > { -+ > puts ("Hello, world!"); -+ > return 0; -+ > } -+ > EOF -+ $ $tools/bin/$target-gcc -Wall hello.c -o hello -+ $ cat > c++-hello.cc < #include -+ > int -+ > main (int argc, char **argv) -+ > { -+ > std::cout << "Hello, C++ world!" << std::endl; -+ > return 0; -+ > } -+ > EOF -+ $ $tools/bin/$target-g++ -Wall c++-hello.cc -o c++-hello -+ -+ -+We can use 'readelf' to verify that these are indeed executables for -+our target, using our dynamic linker: -+ -+ $ $tools/bin/$target-readelf -hl hello -+ ELF Header: -+ ... -+ Type: EXEC (Executable file) -+ Machine: ARM -+ -+ ... -+ Program Headers: -+ Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align -+ PHDR 0x000034 0x10000034 0x10000034 0x00100 0x00100 R E 0x4 -+ INTERP 0x000134 0x00008134 0x00008134 0x00013 0x00013 R 0x1 -+ [Requesting program interpreter: /lib/ld-linux.so.3] -+ LOAD 0x000000 0x00008000 0x00008000 0x0042c 0x0042c R E 0x8000 -+ ... -+ -+Looking at the dynamic section of the installed 'libgcc_s.so', we see -+that the 'NEEDED' entry for the C library does include the '.6' -+suffix, indicating that was linked against our fully build GLIBC, and -+not our dummy 'libc.so': -+ -+ $ $tools/bin/$target-readelf -d $sysroot/lib/libgcc_s.so.1 -+ Dynamic section at offset 0x1083c contains 24 entries: -+ Tag Type Name/Value -+ 0x00000001 (NEEDED) Shared library: [libc.so.6] -+ 0x0000000e (SONAME) Library soname: [libgcc_s.so.1] -+ ... -+ -+ -+And on the target machine, we can run our programs: -+ -+ $ $sysroot/lib/ld.so.1 --library-path $sysroot/lib:$sysroot/usr/lib \ -+ > ./hello -+ Hello, world! -+ $ $sysroot/lib/ld.so.1 --library-path $sysroot/lib:$sysroot/usr/lib \ -+ > ./c++-hello -+ Hello, C++ world! -diff --git a/GLIBC.cross-testing b/GLIBC.cross-testing -new file mode 100644 -index 0000000000..b67b468466 ---- /dev/null -+++ b/GLIBC.cross-testing -@@ -0,0 +1,205 @@ -+ -*- mode: text -*- -+ -+ Cross-Testing With GLIBC -+ Jim Blandy -+ -+ -+Introduction -+ -+Developers writing software for embedded systems often use a desktop -+or other similarly capable computer for development, but need to run -+tests on the embedded system, or perhaps on a simulator. When -+configured for cross-compilation, the stock GNU C library simply -+disables running tests altogether: the command 'make tests' builds -+test programs, but does not run them. GLIBC, however, provides -+facilities for compiling tests and generating data files on the build -+system, but running the test programs themselves on a remote system or -+simulator. -+ -+ -+Test environment requirements -+ -+The test environment must meet certain conditions for GLIBC's -+cross-testing facilities to work: -+ -+- Shared filesystems. The 'build' system, on which you configure and -+ compile GLIBC, and the 'host' system, on which you intend to run -+ GLIBC, must share a filesystem containing the GLIBC build and -+ source trees. Files must appear at the same paths on both systems. -+ -+- Remote-shell like invocation. There must be a way to run a program -+ on the host system from the build system, passing it properly quoted -+ command-line arguments, setting environment variables, and -+ inheriting the caller's standard input and output. -+ -+ -+Usage -+ -+To use GLIBC's cross-testing support, provide values for the -+following Make variables when you invoke 'make': -+ -+- cross-test-wrapper -+ -+ This should be the name of the cross-testing wrapper command, along -+ with any arguments. -+ -+- cross-localedef -+ -+ This should be the name of a cross-capable localedef program, like -+ that included in the GLIBC 'localedef' module, along with any -+ arguments needed. -+ -+These are each explained in detail below. -+ -+ -+The Cross-Testing Wrapper -+ -+To run test programs reliably, the stock GNU C library takes care to -+ensure that test programs use the newly compiled dynamic linker and -+shared libraries, and never the host system's installed libraries. To -+accomplish this, it runs the tests by explicitly invoking the dynamic -+linker from the build tree, passing it a list of build tree -+directories to search for shared libraries, followed by the name of -+the executable to run and its arguments. -+ -+For example, where one might normally run a test program like this: -+ -+ $ ./tst-foo arg1 arg2 -+ -+the GNU C library might run that program like this: -+ -+ $ $objdir/elf/ld-linux.so.3 --library-path $objdir \ -+ ./tst-foo arg1 arg2 -+ -+(where $objdir is the path to the top of the build tree, and the -+trailing backslash indicates a continuation of the command). In other -+words, each test program invocation is 'wrapped up' inside an explicit -+invocation of the dynamic linker, which must itself execute the test -+program, having loaded shared libraries from the appropriate -+directories. -+ -+To support cross-testing, GLIBC allows the developer to optionally -+set the 'cross-test-wrapper' Make variable to another wrapper command, -+to which it passes the entire dynamic linker invocation shown above as -+arguments. For example, if the developer supplies a wrapper of -+'my-wrapper hostname', then GLIBC would run the test above as -+follows: -+ -+ $ my-wrapper hostname \ -+ $objdir/elf/ld-linux.so.3 --library-path $objdir \ -+ ./tst-foo arg1 arg2 -+ -+The 'my-wrapper' command is responsible for executing the command -+given on the host system. -+ -+Since tests are run in varying directories, the wrapper should either -+be in your command search path, or 'cross-test-wrapper' should give an -+absolute path for the wrapper. -+ -+The wrapper must meet several requirements: -+ -+- It must preserve the current directory. As explained above, the -+ build directory tree must be visible on both the build and host -+ systems, at the same path. The test wrapper must ensure that the -+ current directory it inherits is also inherited by the dynamic -+ linker (and thus the test program itself). -+ -+- It must preserve environment variables' values. Many GLIBC tests -+ set environment variables for test runs; in native testing, it -+ invokes programs like this: -+ -+ $ GCONV_PATH=$objdir/iconvdata \ -+ $objdir/elf/ld-linux.so.3 --library-path $objdir \ -+ ./tst-foo arg1 arg2 -+ -+ With the cross-testing wrapper, that invocation becomes: -+ -+ $ GCONV_PATH=$objdir/iconvdata \ -+ my-wrapper hostname \ -+ $objdir/elf/ld-linux.so.3 --library-path $objdir \ -+ ./tst-foo arg1 arg2 -+ -+ Here, 'my-wrapper' must ensure that the value it sees for -+ 'GCONV_PATH' will be seen by the dynamic linker, and thus 'tst-foo' -+ itself. (The wrapper supplied with GLIBC simply preserves the -+ values of *all* enviroment variables, with a fixed set of -+ exceptions.) -+ -+ If your wrapper is a shell script, take care to correctly propagate -+ environment variables whose values contain spaces and shell -+ metacharacters. -+ -+- It must pass the command's arguments, unmodified. The arguments -+ seen by the test program should be exactly those seen by the wrapper -+ (after whatever arguments are given to the wrapper itself). The -+ GLIBC test framework performs all needed shell word splitting and -+ expansion (wildcard expansion, parameter substitution, and so on) -+ before invoking the wrapper; further expansion may break the tests. -+ -+ -+The 'cross-test-ssh.sh' script -+ -+If you want to use 'ssh' (or something sufficiently similar) to run -+test programs on your host system, GLIBC includes a shell script, -+'scripts/cross-test-ssh.sh', which you can use as your wrapper -+command. This script takes care of setting the test command's current -+directory, propagating environment variable values, and carrying -+command-line arguments, all across an 'ssh' connection. You may even -+supply an alternative to 'ssh' on the command line, if needed. -+ -+For more details, pass 'cross-test-ssh.sh' the '--help' option. -+ -+ -+The Cross-Compiling Locale Definition Command -+ -+Some GLIBC tests rely on locales generated especially for the test -+process. In a native configuration, these tests simply run the -+'localedef' command built by the normal GLIBC build process, -+'locale/localedef', to process and install their locales. However, in -+a cross-compiling configuration, this 'localedef' is built for the -+host system, not the build system, and since it requires quite a bit -+of memory to run (we have seen it fail on systems with 64MiB of -+memory), it may not be practical to run it on the host system. -+ -+If set, GLIBC uses the 'cross-localedef' Make variable as the command -+to run on the build system to process and install locales. The -+localedef program built from the GLIBC 'localedef' module is -+suitable. -+ -+The value of 'cross-localedef' may also include command-line arguments -+to be passed to the program; if you are using GLIBC's 'localedef', -+you may include endianness and 'uint32_t' alignment arguments here. -+ -+ -+Example -+ -+In developing GLIBC's cross-testing facility, we invoked 'make' with -+the following script: -+ -+ #!/bin/sh -+ -+ srcdir=... -+ test_hostname=... -+ localedefdir=... -+ cross_gxx=...-g++ -+ -+ wrapper="$srcdir/scripts/cross-test-ssh.sh $test_hostname" -+ localedef="$localedefdir/localedef --little-endian --uint32-align=4" -+ -+ make cross-test-wrapper="$wrapper" \ -+ cross-localedef="$localedef" \ -+ CXX="$cross_gxx" \ -+ "$@" -+ -+ -+Other Cross-Testing Concerns -+ -+Here are notes on some other issues which you may encounter in running -+the GLIBC tests in a cross-compiling environment: -+ -+- Some tests require a C++ cross-compiler; you should set the 'CXX' -+ Make variable to the name of an appropriate cross-compiler. -+ -+- Some tests require access to libstdc++.so.6 and libgcc_s.so.1; we -+ simply place copies of these libraries in the top GLIBC build -+ directory. diff --git a/meta-openeuler/recipes-core/glibc/files/0011-eglibc-Help-bootstrap-cross-toolchain.patch b/meta-openeuler/recipes-core/glibc/files/0011-eglibc-Help-bootstrap-cross-toolchain.patch deleted file mode 100644 index 88017bd29b0451c2cdcef7395ff46892d979020b..0000000000000000000000000000000000000000 --- a/meta-openeuler/recipes-core/glibc/files/0011-eglibc-Help-bootstrap-cross-toolchain.patch +++ /dev/null @@ -1,97 +0,0 @@ -From cf2126b2d6e073137a3a7d9bcc261e0a760a82da Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Wed, 18 Mar 2015 00:49:28 +0000 -Subject: [PATCH] eglibc: Help bootstrap cross toolchain - -Taken from EGLIBC, r1484 + r1525 - - 2007-02-20 Jim Blandy - - * Makefile (install-headers): Preserve old behavior: depend on - $(inst_includedir)/gnu/stubs.h only if install-bootstrap-headers - is set; otherwise, place gnu/stubs.h on the 'install-others' list. - - 2007-02-16 Jim Blandy - - * Makefile: Amend make install-headers to install everything - necessary for building a cross-compiler. Install gnu/stubs.h as - part of 'install-headers', not 'install-others'. - If install-bootstrap-headers is 'yes', install a dummy copy of - gnu/stubs.h, instead of computing the real thing. - * include/stubs-bootstrap.h: New file. - -Upstream-Status: Pending -Signed-off-by: Khem Raj ---- - Makefile | 22 +++++++++++++++++++++- - include/stubs-bootstrap.h | 12 ++++++++++++ - 2 files changed, 33 insertions(+), 1 deletion(-) - create mode 100644 include/stubs-bootstrap.h - -diff --git a/Makefile b/Makefile -index c6d4817a9e..b4b0e23560 100644 ---- a/Makefile -+++ b/Makefile -@@ -79,9 +79,18 @@ subdir-dirs = include - vpath %.h $(subdir-dirs) - - # What to install. --install-others = $(inst_includedir)/gnu/stubs.h - install-bin-script = - -+# If we're bootstrapping, install a dummy gnu/stubs.h along with the -+# other headers, so 'make install-headers' produces a useable include -+# tree. Otherwise, install gnu/stubs.h later, after the rest of the -+# build is done. -+ifeq ($(install-bootstrap-headers),yes) -+install-headers: $(inst_includedir)/gnu/stubs.h -+else -+install-others = $(inst_includedir)/gnu/stubs.h -+endif -+ - ifeq (yes,$(build-shared)) - headers += gnu/lib-names.h - endif -@@ -421,6 +430,16 @@ others: $(common-objpfx)testrun.sh $(common-objpfx)debugglibc.sh - - subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs) - -+# gnu/stubs.h depends (via the subdir 'stubs' targets) on all the .o -+# files in EGLIBC. For bootstrapping a GCC/EGLIBC pair, an empty -+# gnu/stubs.h is good enough. -+ifeq ($(install-bootstrap-headers),yes) -+$(inst_includedir)/gnu/stubs.h: include/stubs-bootstrap.h $(+force) -+ $(make-target-directory) -+ $(INSTALL_DATA) $< $@ -+ -+installed-stubs = -+else - ifndef abi-variants - installed-stubs = $(inst_includedir)/gnu/stubs.h - else -@@ -447,6 +466,7 @@ $(inst_includedir)/gnu/stubs.h: $(+force) - - install-others-nosubdir: $(installed-stubs) - endif -+endif - - - # Since stubs.h is never needed when building the library, we simplify the -diff --git a/include/stubs-bootstrap.h b/include/stubs-bootstrap.h -new file mode 100644 -index 0000000000..1d2b669aff ---- /dev/null -+++ b/include/stubs-bootstrap.h -@@ -0,0 +1,12 @@ -+/* Placeholder stubs.h file for bootstrapping. -+ -+ When bootstrapping a GCC/EGLIBC pair, GCC requires that the EGLIBC -+ headers be installed, but we can't fully build EGLIBC without that -+ GCC. So we run the command: -+ -+ make install-headers install-bootstrap-headers=yes -+ -+ to install the headers GCC needs, but avoid building certain -+ difficult headers. The header depends, via the -+ EGLIBC subdir 'stubs' make targets, on every .o file in EGLIBC, but -+ an empty stubs.h like this will do fine for GCC. */ diff --git a/meta-openeuler/recipes-core/glibc/files/0012-eglibc-Resolve-__fpscr_values-on-SH4.patch b/meta-openeuler/recipes-core/glibc/files/0012-eglibc-Resolve-__fpscr_values-on-SH4.patch deleted file mode 100644 index fee020cc4cc49b878d83c2d04a5a2c68ca52c75e..0000000000000000000000000000000000000000 --- a/meta-openeuler/recipes-core/glibc/files/0012-eglibc-Resolve-__fpscr_values-on-SH4.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 61948c02226acea68d34313cc6286ee1ab44a98c Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Wed, 18 Mar 2015 00:55:53 +0000 -Subject: [PATCH] eglibc: Resolve __fpscr_values on SH4 - -2010-09-29 Nobuhiro Iwamatsu - Andrew Stubbs - - Resolve SH's __fpscr_values to symbol in libc.so. - - * sysdeps/sh/sh4/fpu/fpu_control.h: Add C++ __set_fpscr prototype. - * sysdeps/unix/sysv/linux/sh/Versions (GLIBC_2.2): Add __fpscr_values. - * sysdeps/unix/sysv/linux/sh/sysdep.S (___fpscr_values): New constant. - -Upstream-Status: Pending - -Signed-off-by: Khem Raj ---- - sysdeps/unix/sysv/linux/sh/Versions | 1 + - sysdeps/unix/sysv/linux/sh/sysdep.S | 11 +++++++++++ - 2 files changed, 12 insertions(+) - -diff --git a/sysdeps/unix/sysv/linux/sh/Versions b/sysdeps/unix/sysv/linux/sh/Versions -index 3ad702e165..931985b5d6 100644 ---- a/sysdeps/unix/sysv/linux/sh/Versions -+++ b/sysdeps/unix/sysv/linux/sh/Versions -@@ -3,6 +3,7 @@ libc { - GLIBC_2.2 { - # functions used in other libraries - __xstat64; __fxstat64; __lxstat64; -+ __fpscr_values; - - # a* - alphasort64; -diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.S b/sysdeps/unix/sysv/linux/sh/sysdep.S -index 9d85ff99a0..6bda921ca3 100644 ---- a/sysdeps/unix/sysv/linux/sh/sysdep.S -+++ b/sysdeps/unix/sysv/linux/sh/sysdep.S -@@ -30,3 +30,14 @@ ENTRY (__syscall_error) - - #define __syscall_error __syscall_error_1 - #include -+ -+ .data -+ .align 3 -+ .globl ___fpscr_values -+ .type ___fpscr_values, @object -+ .size ___fpscr_values, 8 -+___fpscr_values: -+ .long 0 -+ .long 0x80000 -+weak_alias (___fpscr_values, __fpscr_values) -+ diff --git a/meta-openeuler/recipes-core/glibc/files/0013-eglibc-Forward-port-cross-locale-generation-support.patch b/meta-openeuler/recipes-core/glibc/files/0013-eglibc-Forward-port-cross-locale-generation-support.patch deleted file mode 100644 index 60bcab0fecdc61340c34f33b65e7531f7287792a..0000000000000000000000000000000000000000 --- a/meta-openeuler/recipes-core/glibc/files/0013-eglibc-Forward-port-cross-locale-generation-support.patch +++ /dev/null @@ -1,560 +0,0 @@ -From befa58c48a8ba664e7bbdfcf22e2a15efa2e0d17 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Wed, 18 Mar 2015 01:33:49 +0000 -Subject: [PATCH] eglibc: Forward port cross locale generation support - -Upstream-Status: Pending - -Signed-off-by: Khem Raj ---- - locale/Makefile | 3 +- - locale/catnames.c | 46 +++++++++++++++++++++++++++ - locale/localeinfo.h | 2 +- - locale/programs/charmap-dir.c | 6 ++++ - locale/programs/ld-collate.c | 17 +++++----- - locale/programs/ld-ctype.c | 27 ++++++++-------- - locale/programs/ld-time.c | 31 ++++++++++++------ - locale/programs/linereader.c | 2 +- - locale/programs/localedef.c | 8 +++++ - locale/programs/locfile.c | 5 ++- - locale/programs/locfile.h | 59 +++++++++++++++++++++++++++++++++-- - locale/setlocale.c | 29 ----------------- - 12 files changed, 167 insertions(+), 68 deletions(-) - create mode 100644 locale/catnames.c - -diff --git a/locale/Makefile b/locale/Makefile -index d7036b0855..ed795e2710 100644 ---- a/locale/Makefile -+++ b/locale/Makefile -@@ -26,7 +26,8 @@ headers = langinfo.h locale.h bits/locale.h \ - bits/types/locale_t.h bits/types/__locale_t.h - routines = setlocale findlocale loadlocale loadarchive \ - localeconv nl_langinfo nl_langinfo_l mb_cur_max \ -- newlocale duplocale freelocale uselocale -+ newlocale duplocale freelocale uselocale \ -+ catnames - tests = tst-C-locale tst-locname tst-duplocale - tests-container = tst-localedef-path-norm - categories = ctype messages monetary numeric time paper name \ -diff --git a/locale/catnames.c b/locale/catnames.c -new file mode 100644 -index 0000000000..538f3f5edb ---- /dev/null -+++ b/locale/catnames.c -@@ -0,0 +1,46 @@ -+/* Copyright (C) 2006 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, write to the Free -+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -+ 02111-1307 USA. */ -+ -+#include "localeinfo.h" -+ -+/* Define an array of category names (also the environment variable names). */ -+const struct catnamestr_t _nl_category_names attribute_hidden = -+ { -+#define DEFINE_CATEGORY(category, category_name, items, a) \ -+ category_name, -+#include "categories.def" -+#undef DEFINE_CATEGORY -+ }; -+ -+const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden = -+ { -+#define DEFINE_CATEGORY(category, category_name, items, a) \ -+ [category] = offsetof (struct catnamestr_t, CATNAMEMF (__LINE__)), -+#include "categories.def" -+#undef DEFINE_CATEGORY -+ }; -+ -+/* An array of their lengths, for convenience. */ -+const uint8_t _nl_category_name_sizes[] attribute_hidden = -+ { -+#define DEFINE_CATEGORY(category, category_name, items, a) \ -+ [category] = sizeof (category_name) - 1, -+#include "categories.def" -+#undef DEFINE_CATEGORY -+ [LC_ALL] = sizeof ("LC_ALL") - 1 -+ }; -diff --git a/locale/localeinfo.h b/locale/localeinfo.h -index 7a930079a5..05d7848d29 100644 ---- a/locale/localeinfo.h -+++ b/locale/localeinfo.h -@@ -246,7 +246,7 @@ __libc_tsd_define (extern, locale_t, LOCALE) - unused. We can manage this playing some tricks with weak references. - But with thread-local locale settings, it becomes quite ungainly unless - we can use __thread variables. So only in that case do we attempt this. */ --#ifndef SHARED -+#if !defined SHARED && !defined IN_GLIBC_LOCALEDEF - # include - # define NL_CURRENT_INDIRECT 1 - #endif -diff --git a/locale/programs/charmap-dir.c b/locale/programs/charmap-dir.c -index 9582f2d167..8f9f3f582c 100644 ---- a/locale/programs/charmap-dir.c -+++ b/locale/programs/charmap-dir.c -@@ -18,7 +18,9 @@ - #include - #include - #include -+#ifndef NO_UNCOMPRESS - #include -+#endif - #include - #include - #include -@@ -154,6 +156,7 @@ charmap_closedir (CHARMAP_DIR *cdir) - return closedir (dir); - } - -+#ifndef NO_UNCOMPRESS - /* Creates a subprocess decompressing the given pathname, and returns - a stream reading its output (the decompressed data). */ - static -@@ -202,6 +205,7 @@ fopen_uncompressed (const char *pathname, const char *compressor) - } - return NULL; - } -+#endif - - /* Opens a charmap for reading, given its name (not an alias name). */ - FILE * -@@ -224,6 +228,7 @@ charmap_open (const char *directory, const char *name) - if (stream != NULL) - return stream; - -+#ifndef NO_UNCOMPRESS - memcpy (p, ".gz", 4); - stream = fopen_uncompressed (pathname, "gzip"); - if (stream != NULL) -@@ -233,6 +238,7 @@ charmap_open (const char *directory, const char *name) - stream = fopen_uncompressed (pathname, "bzip2"); - if (stream != NULL) - return stream; -+#endif - - return NULL; - } -diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c -index 2c9f540bf1..c937cfd2ab 100644 ---- a/locale/programs/ld-collate.c -+++ b/locale/programs/ld-collate.c -@@ -352,7 +352,7 @@ new_element (struct locale_collate_t *collate, const char *mbs, size_t mbslen, - } - if (wcs != NULL) - { -- size_t nwcs = wcslen ((wchar_t *) wcs); -+ size_t nwcs = wcslen_uint32 (wcs); - uint32_t zero = 0; - /* Handle as a single character. */ - if (nwcs == 0) -@@ -1776,8 +1776,7 @@ symbol `%s' has the same encoding as"), (*eptr)->name); - - if ((*eptr)->nwcs == runp->nwcs) - { -- int c = wmemcmp ((wchar_t *) (*eptr)->wcs, -- (wchar_t *) runp->wcs, runp->nwcs); -+ int c = wmemcmp_uint32 ((*eptr)->wcs, runp->wcs, runp->nwcs); - - if (c == 0) - { -@@ -2004,9 +2003,9 @@ add_to_tablewc (uint32_t ch, struct element_t *runp) - one consecutive entry. */ - if (runp->wcnext != NULL - && runp->nwcs == runp->wcnext->nwcs -- && wmemcmp ((wchar_t *) runp->wcs, -- (wchar_t *)runp->wcnext->wcs, -- runp->nwcs - 1) == 0 -+ && wmemcmp_uint32 (runp->wcs, -+ runp->wcnext->wcs, -+ runp->nwcs - 1) == 0 - && (runp->wcs[runp->nwcs - 1] - == runp->wcnext->wcs[runp->nwcs - 1] + 1)) - { -@@ -2030,9 +2029,9 @@ add_to_tablewc (uint32_t ch, struct element_t *runp) - runp = runp->wcnext; - while (runp->wcnext != NULL - && runp->nwcs == runp->wcnext->nwcs -- && wmemcmp ((wchar_t *) runp->wcs, -- (wchar_t *)runp->wcnext->wcs, -- runp->nwcs - 1) == 0 -+ && wmemcmp_uint32 (runp->wcs, -+ runp->wcnext->wcs, -+ runp->nwcs - 1) == 0 - && (runp->wcs[runp->nwcs - 1] - == runp->wcnext->wcs[runp->nwcs - 1] + 1)); - -diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c -index d285b72611..4bf01fa3db 100644 ---- a/locale/programs/ld-ctype.c -+++ b/locale/programs/ld-ctype.c -@@ -914,7 +914,7 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap, - allocate_arrays (ctype, charmap, ctype->repertoire); - - default_missing_len = (ctype->default_missing -- ? wcslen ((wchar_t *) ctype->default_missing) -+ ? wcslen_uint32 (ctype->default_missing) - : 0); - - init_locale_data (&file, nelems); -@@ -1926,7 +1926,7 @@ read_translit_entry (struct linereader *ldfile, struct locale_ctype_t *ctype, - ignore = 1; - else - /* This value is usable. */ -- obstack_grow (ob, to_wstr, wcslen ((wchar_t *) to_wstr) * 4); -+ obstack_grow (ob, to_wstr, wcslen_uint32 (to_wstr) * 4); - - first = 0; - } -@@ -2460,8 +2460,8 @@ with character code range values one must use the absolute ellipsis `...'")); - } - - handle_tok_digit: -- class_bit = _ISwdigit; -- class256_bit = _ISdigit; -+ class_bit = BITw (tok_digit); -+ class256_bit = BIT (tok_digit); - handle_digits = 1; - goto read_charclass; - -@@ -3876,8 +3876,7 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, - - while (idx < number) - { -- int res = wcscmp ((const wchar_t *) sorted[idx]->from, -- (const wchar_t *) runp->from); -+ int res = wcscmp_uint32 (sorted[idx]->from, runp->from); - if (res == 0) - { - replace = 1; -@@ -3914,11 +3913,11 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, - for (size_t cnt = 0; cnt < number; ++cnt) - { - struct translit_to_t *srunp; -- from_len += wcslen ((const wchar_t *) sorted[cnt]->from) + 1; -+ from_len += wcslen_uint32 (sorted[cnt]->from) + 1; - srunp = sorted[cnt]->to; - while (srunp != NULL) - { -- to_len += wcslen ((const wchar_t *) srunp->str) + 1; -+ to_len += wcslen_uint32 (srunp->str) + 1; - srunp = srunp->next; - } - /* Plus one for the extra NUL character marking the end of -@@ -3942,18 +3941,18 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, - ctype->translit_from_idx[cnt] = from_len; - ctype->translit_to_idx[cnt] = to_len; - -- len = wcslen ((const wchar_t *) sorted[cnt]->from) + 1; -- wmemcpy ((wchar_t *) &ctype->translit_from_tbl[from_len], -- (const wchar_t *) sorted[cnt]->from, len); -+ len = wcslen_uint32 (sorted[cnt]->from) + 1; -+ wmemcpy_uint32 (&ctype->translit_from_tbl[from_len], -+ sorted[cnt]->from, len); - from_len += len; - - ctype->translit_to_idx[cnt] = to_len; - srunp = sorted[cnt]->to; - while (srunp != NULL) - { -- len = wcslen ((const wchar_t *) srunp->str) + 1; -- wmemcpy ((wchar_t *) &ctype->translit_to_tbl[to_len], -- (const wchar_t *) srunp->str, len); -+ len = wcslen_uint32 (srunp->str) + 1; -+ wmemcpy_uint32 (&ctype->translit_to_tbl[to_len], -+ srunp->str, len); - to_len += len; - srunp = srunp->next; - } -diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c -index a590b013b3..5ed4fa0f59 100644 ---- a/locale/programs/ld-time.c -+++ b/locale/programs/ld-time.c -@@ -219,8 +219,10 @@ No definition for %s category found"), "LC_TIME"); - } - else - { -+ static const uint32_t wt_fmt_ampm[] -+ = { '%','I',':','%','M',':','%','S',' ','%','p',0 }; - time->t_fmt_ampm = "%I:%M:%S %p"; -- time->wt_fmt_ampm = (const uint32_t *) L"%I:%M:%S %p"; -+ time->wt_fmt_ampm = wt_fmt_ampm; - } - } - -@@ -230,7 +232,7 @@ No definition for %s category found"), "LC_TIME"); - const int days_per_month[12] = { 31, 29, 31, 30, 31, 30, - 31, 31, 30, 31 ,30, 31 }; - size_t idx; -- wchar_t *wstr; -+ uint32_t *wstr; - - time->era_entries = - (struct era_data *) xmalloc (time->num_era -@@ -456,18 +458,18 @@ No definition for %s category found"), "LC_TIME"); - } - - /* Now generate the wide character name and format. */ -- wstr = wcschr ((wchar_t *) time->wera[idx], L':');/* end direction */ -- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end offset */ -- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end start */ -- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end end */ -+ wstr = wcschr_uint32 (time->wera[idx], L':'); /* end direction */ -+ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end offset */ -+ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end start */ -+ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end end */ - if (wstr != NULL) - { -- time->era_entries[idx].wname = (uint32_t *) wstr + 1; -- wstr = wcschr (wstr + 1, L':'); /* end name */ -+ time->era_entries[idx].wname = wstr + 1; -+ wstr = wcschr_uint32 (wstr + 1, L':'); /* end name */ - if (wstr != NULL) - { - *wstr = L'\0'; -- time->era_entries[idx].wformat = (uint32_t *) wstr + 1; -+ time->era_entries[idx].wformat = wstr + 1; - } - else - time->era_entries[idx].wname = -@@ -526,7 +528,16 @@ No definition for %s category found"), "LC_TIME"); - if (time->date_fmt == NULL) - time->date_fmt = "%a %b %e %H:%M:%S %Z %Y"; - if (time->wdate_fmt == NULL) -- time->wdate_fmt = (const uint32_t *) L"%a %b %e %H:%M:%S %Z %Y"; -+ { -+ static const uint32_t wdate_fmt[] = -+ { '%','a',' ', -+ '%','b',' ', -+ '%','e',' ', -+ '%','H',':','%','M',':','%','S',' ', -+ '%','Z',' ', -+ '%','Y',0 }; -+ time->wdate_fmt = wdate_fmt; -+ } - } - - -diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c -index f8c49ac06f..ddda006037 100644 ---- a/locale/programs/linereader.c -+++ b/locale/programs/linereader.c -@@ -776,7 +776,7 @@ get_string (struct linereader *lr, const struct charmap_t *charmap, - { - int return_widestr = lr->return_widestr; - struct lr_buffer lrb; -- wchar_t *buf2 = NULL; -+ uint32_t *buf2 = NULL; - - lr_buffer_init (&lrb); - -diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c -index 1b751bb7be..c255e2b436 100644 ---- a/locale/programs/localedef.c -+++ b/locale/programs/localedef.c -@@ -108,6 +108,7 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; - #define OPT_NO_WARN 402 - #define OPT_WARN 403 - #define OPT_NO_HARD_LINKS 404 -+#define OPT_UINT32_ALIGN 405 - - /* Definitions of arguments for argp functions. */ - static const struct argp_option options[] = -@@ -152,6 +153,8 @@ static const struct argp_option options[] = - N_("Generate little-endian output") }, - { "big-endian", OPT_BIG_ENDIAN, NULL, 0, - N_("Generate big-endian output") }, -+ { "uint32-align", OPT_UINT32_ALIGN, "ALIGNMENT", 0, -+ N_("Set the target's uint32_t alignment in bytes (default 4)") }, - { NULL, 0, NULL, 0, NULL } - }; - -@@ -242,12 +245,14 @@ main (int argc, char *argv[]) - ctype locale. (P1003.2 4.35.5.2) */ - setlocale (LC_CTYPE, "POSIX"); - -+#ifndef NO_SYSCONF - /* Look whether the system really allows locale definitions. POSIX - defines error code 3 for this situation so I think it must be - a fatal error (see P1003.2 4.35.8). */ - if (sysconf (_SC_2_LOCALEDEF) < 0) - record_error (3, 0, _("\ - FATAL: system does not define `_POSIX2_LOCALEDEF'")); -+#endif - - /* Process charmap file. */ - charmap = charmap_read (charmap_file, verbose, 1, be_quiet, 1); -@@ -399,6 +404,9 @@ parse_opt (int key, char *arg, struct argp_state *state) - /* Do not hard link to other locales. */ - hard_links = false; - break; -+ case OPT_UINT32_ALIGN: -+ uint32_align_mask = strtol (arg, NULL, 0) - 1; -+ break; - case 'c': - force_output = 1; - break; -diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c -index e3eef59295..711d6fbea0 100644 ---- a/locale/programs/locfile.c -+++ b/locale/programs/locfile.c -@@ -543,6 +543,9 @@ compare_files (const char *filename1, const char *filename2, size_t size, - machine running localedef. */ - bool swap_endianness_p; - -+/* The target's value of __align__(uint32_t) - 1. */ -+unsigned int uint32_align_mask = 3; -+ - /* When called outside a start_locale_structure/end_locale_structure - or start_locale_prelude/end_locale_prelude block, record that the - next byte in FILE's obstack will be the first byte of a new element. -@@ -620,7 +623,7 @@ add_locale_string (struct locale_file *file, const char *string) - void - add_locale_wstring (struct locale_file *file, const uint32_t *string) - { -- add_locale_uint32_array (file, string, wcslen ((const wchar_t *) string) + 1); -+ add_locale_uint32_array (file, string, wcslen_uint32 (string) + 1); - } - - /* Record that FILE's next element is the 32-bit integer VALUE. */ -diff --git a/locale/programs/locfile.h b/locale/programs/locfile.h -index 5caf5c348f..76856a32c2 100644 ---- a/locale/programs/locfile.h -+++ b/locale/programs/locfile.h -@@ -70,6 +70,8 @@ extern void write_all_categories (struct localedef_t *definitions, - - extern bool swap_endianness_p; - -+extern unsigned int uint32_align_mask; -+ - /* Change the output to be big-endian if BIG_ENDIAN is true and - little-endian otherwise. */ - static inline void -@@ -88,7 +90,8 @@ maybe_swap_uint32 (uint32_t value) - } - - /* Likewise, but munge an array of N uint32_ts starting at ARRAY. */ --static inline void -+static void -+__attribute__ ((unused)) - maybe_swap_uint32_array (uint32_t *array, size_t n) - { - if (swap_endianness_p) -@@ -98,7 +101,8 @@ maybe_swap_uint32_array (uint32_t *array, size_t n) - - /* Like maybe_swap_uint32_array, but the array of N elements is at - the end of OBSTACK's current object. */ --static inline void -+static void -+__attribute__ ((unused)) - maybe_swap_uint32_obstack (struct obstack *obstack, size_t n) - { - maybe_swap_uint32_array ((uint32_t *) obstack_next_free (obstack) - n, n); -@@ -275,4 +279,55 @@ extern void identification_output (struct localedef_t *locale, - const struct charmap_t *charmap, - const char *output_path); - -+static size_t wcslen_uint32 (const uint32_t *str) __attribute__ ((unused)); -+static uint32_t * wmemcpy_uint32 (uint32_t *s1, const uint32_t *s2, size_t n) __attribute__ ((unused)); -+static uint32_t * wcschr_uint32 (const uint32_t *s, uint32_t ch) __attribute__ ((unused)); -+static int wcscmp_uint32 (const uint32_t *s1, const uint32_t *s2) __attribute__ ((unused)); -+static int wmemcmp_uint32 (const uint32_t *s1, const uint32_t *s2, size_t n) __attribute__ ((unused)); -+ -+static size_t -+wcslen_uint32 (const uint32_t *str) -+{ -+ size_t len = 0; -+ while (str[len] != 0) -+ len++; -+ return len; -+} -+ -+static int -+wmemcmp_uint32 (const uint32_t *s1, const uint32_t *s2, size_t n) -+{ -+ while (n-- != 0) -+ { -+ int diff = *s1++ - *s2++; -+ if (diff != 0) -+ return diff; -+ } -+ return 0; -+} -+ -+static int -+wcscmp_uint32 (const uint32_t *s1, const uint32_t *s2) -+{ -+ while (*s1 != 0 && *s1 == *s2) -+ s1++, s2++; -+ return *s1 - *s2; -+} -+ -+static uint32_t * -+wmemcpy_uint32 (uint32_t *s1, const uint32_t *s2, size_t n) -+{ -+ return memcpy (s1, s2, n * sizeof (uint32_t)); -+} -+ -+static uint32_t * -+wcschr_uint32 (const uint32_t *s, uint32_t ch) -+{ -+ do -+ if (*s == ch) -+ return (uint32_t *) s; -+ while (*s++ != 0); -+ return 0; -+} -+ - #endif /* locfile.h */ -diff --git a/locale/setlocale.c b/locale/setlocale.c -index 6a902faa50..17413f0a9c 100644 ---- a/locale/setlocale.c -+++ b/locale/setlocale.c -@@ -63,35 +63,6 @@ static char *const _nl_current_used[] = - - #endif - -- --/* Define an array of category names (also the environment variable names). */ --const struct catnamestr_t _nl_category_names attribute_hidden = -- { --#define DEFINE_CATEGORY(category, category_name, items, a) \ -- category_name, --#include "categories.def" --#undef DEFINE_CATEGORY -- }; -- --const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden = -- { --#define DEFINE_CATEGORY(category, category_name, items, a) \ -- [category] = offsetof (struct catnamestr_t, CATNAMEMF (__LINE__)), --#include "categories.def" --#undef DEFINE_CATEGORY -- }; -- --/* An array of their lengths, for convenience. */ --const uint8_t _nl_category_name_sizes[] attribute_hidden = -- { --#define DEFINE_CATEGORY(category, category_name, items, a) \ -- [category] = sizeof (category_name) - 1, --#include "categories.def" --#undef DEFINE_CATEGORY -- [LC_ALL] = sizeof ("LC_ALL") - 1 -- }; -- -- - #ifdef NL_CURRENT_INDIRECT - # define WEAK_POSTLOAD(postload) weak_extern (postload) - #else diff --git a/meta-openeuler/recipes-core/glibc/files/0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch b/meta-openeuler/recipes-core/glibc/files/0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch deleted file mode 100644 index 3e7d5b74c1b203c81280dce3e27709f7c71aaf57..0000000000000000000000000000000000000000 --- a/meta-openeuler/recipes-core/glibc/files/0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 653b0631f80f17abe01957c06ef8a8d5d189b789 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 3 Aug 2018 09:42:06 -0700 -Subject: [PATCH] localedef --add-to-archive uses a hard-coded locale path - -it doesn't exist in normal use, and there's no way to pass an -alternative filename. - -Add a fallback of $LOCALEARCHIVE from the environment, and allow -creation of new locale archives that are not the system archive. - -Upstream-Status: Inappropriate (OE-specific) - -Signed-off-by: Ross Burton -Signed-off-by: Khem Raj ---- - locale/programs/locarchive.c | 35 +++++++++++++++++++++++++---------- - 1 file changed, 25 insertions(+), 10 deletions(-) - -diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c -index 71fd9f34fa..cd3eb90ad5 100644 ---- a/locale/programs/locarchive.c -+++ b/locale/programs/locarchive.c -@@ -339,12 +339,24 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head) - struct namehashent *oldnamehashtab; - struct locarhandle new_ah; - size_t prefix_len = output_prefix ? strlen (output_prefix) : 0; -- char archivefname[prefix_len + sizeof (ARCHIVE_NAME)]; -- char fname[prefix_len + sizeof (ARCHIVE_NAME) + sizeof (".XXXXXX") - 1]; -+ char *archivefname; -+ char *fname; -+ char *envarchive = getenv("LOCALEARCHIVE"); - -- if (output_prefix) -- memcpy (archivefname, output_prefix, prefix_len); -- strcpy (archivefname + prefix_len, ARCHIVE_NAME); -+ if (envarchive != NULL) -+ { -+ archivefname = xmalloc(strlen(envarchive) + 1); -+ fname = xmalloc(strlen(envarchive) + sizeof (".XXXXXX")); -+ strcpy (archivefname, envarchive); -+ } -+ else -+ { -+ archivefname = xmalloc(prefix_len + sizeof (ARCHIVE_NAME)); -+ fname = xmalloc(prefix_len + sizeof (ARCHIVE_NAME) + sizeof (".XXXXXX") - 1); -+ if (output_prefix) -+ memcpy (archivefname, output_prefix, prefix_len); -+ strcpy (archivefname + prefix_len, ARCHIVE_NAME); -+ } - strcpy (stpcpy (fname, archivefname), ".XXXXXX"); - - /* Not all of the old file has to be mapped. Change this now this -@@ -568,10 +580,13 @@ open_archive (struct locarhandle *ah, bool readonly) - /* If ah has a non-NULL fname open that otherwise open the default. */ - if (archivefname == NULL) - { -- archivefname = default_fname; -- if (output_prefix) -- memcpy (default_fname, output_prefix, prefix_len); -- strcpy (default_fname + prefix_len, ARCHIVE_NAME); -+ archivefname = getenv("LOCALEARCHIVE"); -+ if (archivefname == NULL) { -+ archivefname = default_fname; -+ if (output_prefix) -+ memcpy (default_fname, output_prefix, prefix_len); -+ strcpy (default_fname + prefix_len, ARCHIVE_NAME); -+ } - } - - while (1) -@@ -584,7 +599,7 @@ open_archive (struct locarhandle *ah, bool readonly) - the default locale archive we ignore the failure and - list an empty archive, otherwise we print an error - and exit. */ -- if (errno == ENOENT && archivefname == default_fname) -+ if (errno == ENOENT) - { - if (readonly) - { diff --git a/meta-openeuler/recipes-core/glibc/files/0017-Replace-echo-with-printf-builtin-in-nscd-init-script.patch b/meta-openeuler/recipes-core/glibc/files/0017-Replace-echo-with-printf-builtin-in-nscd-init-script.patch deleted file mode 100644 index f2ed82108156c159c870a4c9d2ef2983b5f9ac27..0000000000000000000000000000000000000000 --- a/meta-openeuler/recipes-core/glibc/files/0017-Replace-echo-with-printf-builtin-in-nscd-init-script.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 63611cfd3b25f3656db168aee41a5850ac769dfc Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Thu, 31 Dec 2015 14:33:02 -0800 -Subject: [PATCH] Replace echo with printf builtin in nscd init script - -The nscd init script calls for #! /bin/bash interpreter -since it uses bash specific extentions namely (translated strings) -and echo -n command, replace echo with printf and -switch the shell interpreter to #!/bin/sh. - -Upstream-Status: Pending -Signed-off-by: Ross Burton -Signed-off-by: Khem Raj ---- - nscd/nscd.init | 20 ++++++++++---------- - 1 file changed, 10 insertions(+), 10 deletions(-) - -diff --git a/nscd/nscd.init b/nscd/nscd.init -index a882da7d8b..857b541381 100644 ---- a/nscd/nscd.init -+++ b/nscd/nscd.init -@@ -1,4 +1,4 @@ --#!/bin/bash -+#!/bin/sh - # - # nscd: Starts the Name Switch Cache Daemon - # -@@ -49,16 +49,16 @@ prog=nscd - start () { - [ -d /var/run/nscd ] || mkdir /var/run/nscd - [ -d /var/db/nscd ] || mkdir /var/db/nscd -- echo -n $"Starting $prog: " -+ printf "Starting $prog: " - daemon /usr/sbin/nscd - RETVAL=$? -- echo -+ printf "\n" - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nscd - return $RETVAL - } - - stop () { -- echo -n $"Stopping $prog: " -+ printf "Stopping $prog: " - /usr/sbin/nscd -K - RETVAL=$? - if [ $RETVAL -eq 0 ]; then -@@ -67,11 +67,11 @@ stop () { - # a non-privileged user - rm -f /var/run/nscd/nscd.pid - rm -f /var/run/nscd/socket -- success $"$prog shutdown" -+ success "$prog shutdown" - else -- failure $"$prog shutdown" -+ failure "$prog shutdown" - fi -- echo -+ printf "\n" - return $RETVAL - } - -@@ -103,13 +103,13 @@ case "$1" in - RETVAL=$? - ;; - force-reload | reload) -- echo -n $"Reloading $prog: " -+ printf "Reloading $prog: " - killproc /usr/sbin/nscd -HUP - RETVAL=$? -- echo -+ printf "\n" - ;; - *) -- echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}" -+ printf "Usage: $0 {start|stop|status|restart|reload|condrestart}\n" - RETVAL=1 - ;; - esac diff --git a/meta-openeuler/recipes-core/glibc/files/0019-timezone-Make-shell-interpreter-overridable-in-tzsel.patch b/meta-openeuler/recipes-core/glibc/files/0019-timezone-Make-shell-interpreter-overridable-in-tzsel.patch deleted file mode 100644 index 359b1c37e5ee4a6bcb8693789947533540b14a58..0000000000000000000000000000000000000000 --- a/meta-openeuler/recipes-core/glibc/files/0019-timezone-Make-shell-interpreter-overridable-in-tzsel.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 1d518ac57b00a3335f80f10f899c1bc24a0ddbf5 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Thu, 9 Dec 2021 15:14:42 -0800 -Subject: [PATCH] timezone: Make shell interpreter overridable in tzselect.ksh - -define new macro called KSHELL which can be used to define default shell -use Bash by default - -Upstream-Status: Pending -Signed-off-by: Khem Raj ---- - Makeconfig | 9 +++++++++ - timezone/Makefile | 1 + - 2 files changed, 10 insertions(+) - -diff --git a/Makeconfig b/Makeconfig -index 77d7fd14df..e253046861 100644 ---- a/Makeconfig -+++ b/Makeconfig -@@ -309,6 +309,15 @@ ifndef sysincludedir - sysincludedir = /usr/include - endif - -+# The full path name of a Posix-compliant shell, preferably one that supports -+# the Korn shell's 'select' statement as an extension. -+# These days, Bash is the most popular. -+# It should be OK to set this to /bin/sh, on platforms where /bin/sh -+# lacks 'select' or doesn't completely conform to Posix, but /bin/bash -+# is typically nicer if it works. -+ifndef KSHELL -+KSHELL = /bin/bash -+endif - - # Commands to install files. - ifndef INSTALL_DATA -diff --git a/timezone/Makefile b/timezone/Makefile -index 0306c0bca9..4dfdcebdb7 100644 ---- a/timezone/Makefile -+++ b/timezone/Makefile -@@ -136,6 +136,7 @@ $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make - -e '/TZVERSION=/s|see_Makefile|"$(version)"|' \ - -e '/PKGVERSION=/s|=.*|="$(PKGVERSION)"|' \ - -e '/REPORT_BUGS_TO=/s|=.*|="$(REPORT_BUGS_TO)"|' \ -+ -e 's|#!/bin/bash|#!$(KSHELL)|g' \ - < $< > $@.new - chmod 555 $@.new - mv -f $@.new $@ diff --git a/meta-openeuler/recipes-core/glibc/files/localedef-master-e0eca29.zip b/meta-openeuler/recipes-core/glibc/files/localedef-master-e0eca29.zip deleted file mode 100644 index 48a621e253e393e5c70be9f006724202d946aec0..0000000000000000000000000000000000000000 Binary files a/meta-openeuler/recipes-core/glibc/files/localedef-master-e0eca29.zip and /dev/null differ diff --git a/meta-openeuler/recipes-core/glibc/glibc-collateral.inc b/meta-openeuler/recipes-core/glibc/glibc-collateral.inc deleted file mode 100644 index 4f81f07da778637fcb73fdb700760cc6e8d09f4f..0000000000000000000000000000000000000000 --- a/meta-openeuler/recipes-core/glibc/glibc-collateral.inc +++ /dev/null @@ -1,12 +0,0 @@ -require glibc-common.inc - -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6 \ - file://${COMMON_LICENSE_DIR}/LGPL-2.1-only;md5=1a6d268fd218675ffea8be556788b780" - -deltask do_fetch -deltask do_unpack -deltask do_patch -do_configure[noexec] = "1" -do_compile[noexec] = "1" - -do_install[depends] += "virtual/${MLPREFIX}libc:do_stash_locale" diff --git a/meta-openeuler/recipes-core/glibc/glibc-common.inc b/meta-openeuler/recipes-core/glibc/glibc-common.inc deleted file mode 100644 index be33c29857ce1438ec174b210f8419aab589f091..0000000000000000000000000000000000000000 --- a/meta-openeuler/recipes-core/glibc/glibc-common.inc +++ /dev/null @@ -1,25 +0,0 @@ -SUMMARY = "GLIBC (GNU C Library)" -DESCRIPTION = "The GNU C Library is used as the system C library in most systems with the Linux kernel." -HOMEPAGE = "http://www.gnu.org/software/libc/libc.html" -SECTION = "libs" -LICENSE = "GPL-2.0-only & LGPL-2.1-only" - -LIC_FILES_CHKSUM ?= "file://LICENSES;md5=1541fd8f5e8f1579512bf05f533371ba \ - file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \ - file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c" - -CVE_PRODUCT = "glibc" - -INHIBIT_DEFAULT_DEPS = "1" - -ARM_INSTRUCTION_SET:armv4 = "arm" -ARM_INSTRUCTION_SET:armv5 = "arm" -ARM_INSTRUCTION_SET:armv6 = "arm" -# -# We will skip parsing glibc when target system C library selection is not glibc -# this helps in easing out parsing for non-glibc system libraries -# -COMPATIBLE_HOST:libc-musl:class-target = "null" - -PV = "2.38" diff --git a/meta-openeuler/recipes-core/glibc/glibc-locale.inc b/meta-openeuler/recipes-core/glibc/glibc-locale.inc deleted file mode 100644 index 289f58d4df9bd4209bbe4dcb6901566410afc4c4..0000000000000000000000000000000000000000 --- a/meta-openeuler/recipes-core/glibc/glibc-locale.inc +++ /dev/null @@ -1,97 +0,0 @@ -require glibc-collateral.inc - -SUMMARY = "Locale data from glibc" - -BPN = "glibc" -LOCALEBASEPN = "${MLPREFIX}glibc" - -# Do not inhibit default deps, do_package requires binutils/gcc for -# objcopy/gcc-nm and glibc-locale depends on virtual/libc directly. -INHIBIT_DEFAULT_DEPS = "" - -# Binary locales are generated at build time if ENABLE_BINARY_LOCALE_GENERATION -# is set. The idea is to avoid running localedef on the target (at first boot) -# to decrease initial boot time and avoid localedef being killed by the OOM -# killer which used to effectively break i18n on machines with < 128MB RAM. - -# default to disabled -ENABLE_BINARY_LOCALE_GENERATION ?= "0" -ENABLE_BINARY_LOCALE_GENERATION:pn-nativesdk-glibc-locale = "1" - -#enable locale generation on these arches -# BINARY_LOCALE_ARCHES is a space separated list of regular expressions -BINARY_LOCALE_ARCHES ?= "arc arm.* aarch64 i[3-6]86 x86_64 powerpc mips mips64 riscv32 riscv64 loongarch64" - -# set "1" to use cross-localedef for locale generation -# set "0" for qemu emulation of native localedef for locale generation -LOCALE_GENERATION_WITH_CROSS-LOCALEDEF = "1" - -PROVIDES = "virtual/libc-locale" - -PACKAGES = "localedef ${PN}-dbg" - -PACKAGES_DYNAMIC = "^locale-base-.* \ - ^glibc-gconv-.* ^glibc-charmap-.* ^glibc-localedata-.* ^glibc-binary-localedata-.* \ - ^${MLPREFIX}glibc-gconv$" - -# Create a glibc-binaries package -ALLOW_EMPTY:${BPN}-binaries = "1" -PACKAGES += "${BPN}-binaries" -RRECOMMENDS:${BPN}-binaries = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-binary-") != -1])}" - -# Create a glibc-charmaps package -ALLOW_EMPTY:${BPN}-charmaps = "1" -PACKAGES += "${BPN}-charmaps" -RRECOMMENDS:${BPN}-charmaps = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-charmap-") != -1])}" - -# Create a glibc-gconvs package -ALLOW_EMPTY:${BPN}-gconvs = "1" -PACKAGES += "${BPN}-gconvs" -RRECOMMENDS:${BPN}-gconvs = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-gconv-") != -1])}" - -# Create a glibc-localedatas package -ALLOW_EMPTY:${BPN}-localedatas = "1" -PACKAGES += "${BPN}-localedatas" -RRECOMMENDS:${BPN}-localedatas = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-localedata-") != -1])}" - -DESCRIPTION:localedef = "glibc: compile locale definition files" - -# glibc-gconv is dynamically added into PACKAGES, thus -# FILES:glibc-gconv will not be automatically extended in multilib. -# Explicitly add ${MLPREFIX} for FILES:glibc-gconv. -FILES:${MLPREFIX}glibc-gconv = "${libdir}/gconv/*" -FILES:localedef = "${bindir}/localedef" - -LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale" - -copy_locale_files() { - local dir=$1 mode=$2 - - [ -e "${LOCALETREESRC}$dir" ] || return 0 - - for d in . $(find "${LOCALETREESRC}$dir" -type d -printf '%P '); do - install -d ${D}$dir/$d - find "${LOCALETREESRC}$dir/$d" -maxdepth 1 -type f \ - -exec install -m $mode -t "${D}$dir/$d" {} \; - done -} - -do_install() { - copy_locale_files ${bindir} 0755 - copy_locale_files ${localedir} 0644 - if [ ${PACKAGE_NO_GCONV} -eq 0 ]; then - copy_locale_files ${libdir}/gconv 0755 - copy_locale_files ${datadir}/i18n 0644 - fi - # Remove empty dirs in libdir when gconv or locales are not copied - find ${D}${libdir} -type d -empty -delete - copy_locale_files ${datadir}/locale 0644 - install -m 0644 ${LOCALETREESRC}/SUPPORTED ${WORKDIR}/SUPPORTED -} - -inherit libc-package - -BBCLASSEXTEND = "nativesdk" - -# Don't scan for CVEs as glibc will be scanned -CVE_PRODUCT = "" diff --git a/meta-openeuler/recipes-core/glibc/glibc-locale_2.38.bb b/meta-openeuler/recipes-core/glibc/glibc-locale_2.38.bb deleted file mode 100644 index f7702e0358c1eb4dca70a51ba870b229516f844c..0000000000000000000000000000000000000000 --- a/meta-openeuler/recipes-core/glibc/glibc-locale_2.38.bb +++ /dev/null @@ -1 +0,0 @@ -require glibc-locale.inc diff --git a/meta-openeuler/recipes-core/glibc/glibc-version.inc b/meta-openeuler/recipes-core/glibc/glibc-version.inc deleted file mode 100644 index f53e59103e2749ed71345f0424f995e63ce8ec36..0000000000000000000000000000000000000000 --- a/meta-openeuler/recipes-core/glibc/glibc-version.inc +++ /dev/null @@ -1,8 +0,0 @@ -SRCBRANCH ?= "release/2.38/master" -PV = "2.38" -SRCREV_glibc ?= "36f2487f13e3540be9ee0fb51876b1da72176d3f" -SRCREV_localedef ?= "e0eca29583b9e0f62645c4316ced93cf4e4e26e1" - -GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git;protocol=https" - -UPSTREAM_CHECK_GITTAGREGEX = "(?P\d+\.\d+(\.(?!90)\d+)*)"