From patchwork Tue Sep 8 11:33:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 1359681 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=flQxJJQj; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bm32d4sYKz9sTS for ; Tue, 8 Sep 2020 21:34:17 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id D3AA722794; Tue, 8 Sep 2020 11:34:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rSVQKrAh40Df; Tue, 8 Sep 2020 11:33:54 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id CC4DC275C6; Tue, 8 Sep 2020 11:33:48 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 9CFDD1BF82B for ; Tue, 8 Sep 2020 11:33:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 90C62275C6 for ; Tue, 8 Sep 2020 11:33:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9XcMsaYyZCs3 for ; Tue, 8 Sep 2020 11:33:41 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) by silver.osuosl.org (Postfix) with ESMTPS id 4F08D22794 for ; Tue, 8 Sep 2020 11:33:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1599564822; x=1631100822; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HFfMAe4dnMGwA3Fwky9SgTeLHSHdwo8C+UnDl1ZS0hc=; b=flQxJJQjMFtNRNoIKLhdsQsABx9FG/AIutOfioWdTDIeUzzphDEwHdsi 2E1VQg6fOVQL51wRw2tCUqGM3W55exdVuTbDFsp8TZq2kkhVbGwm4kVbT E6RjL4Nds9ObSio2wW/zKiPcKlEX1FKZrN8teUxBcDSqSaWYVwFurcGZS fHxaoPnojkFMBUXNRQcBVuizh9GcbuqYXwlI+x1HaowPxWIjL2BFKF6qV zbngwzs8Yp8z5v6yfVyObzyqi4megFB39fBbjFkvxuFt4AOYMBUkVqfPI JGTCq2Po/0aXo/rALoGP8h2Gv+3berhFfN3p5PycDIW5xpqdLR/BFdr5B g==; IronPort-SDR: iYpUUYr0EPbEEj9JpU8Uv0JhpN69w0KtITXJ2N6FTe/aHUHGoiYOTdmlya/aHW3575OXoedMBf pLaukdHgH3iQwr100gLqXLYsx8jf1kM3kTbhpygarz+MDNuzMXiWhqT5nfkPRcgWR7MJYh7R8d BfF7QYCc7xGJo6W8mUQtQxA//STG0l8gshSgSi5FXuU/bjs4jGXEf3VYiljLqsjXLxZ96B39Xm MfbuhHoTwDgbyiNP9tBbImBDoxhhigA4x8BKNgrl8DrFPStc+zHYaptmMqtc/dq06fURvxGz7p jRE= X-IronPort-AV: E=Sophos;i="5.76,405,1592841600"; d="scan'208";a="146809725" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 08 Sep 2020 19:33:38 +0800 IronPort-SDR: sEuv5H4ve3n1wgas1bFZBFlly0VdBuPtOCwamxxOEW0oDs7a0k84uepkSKRywMwY3GaR1nquxi fgTxqX9Ex83w== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Sep 2020 04:20:03 -0700 IronPort-SDR: ScIb3MgZibKJHUGaDf3e1WocfmbQ1KIwGqDtIm6LCBD0yJpWfbYmDWTteymP3WcHFhc1KZZ6VR wi/uuuwoV6Rw== WDCIronportException: Internal Received: from cnf002038.ad.shared (HELO localhost.hgst.com) ([10.84.70.94]) by uls-op-cesaip02.wdc.com with ESMTP; 08 Sep 2020 04:33:35 -0700 From: Damien Le Moal To: buildroot@buildroot.org Date: Tue, 8 Sep 2020 20:33:23 +0900 Message-Id: <20200908113324.1022230-6-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908113324.1022230-1-damien.lemoal@wdc.com> References: <20200908113324.1022230-1-damien.lemoal@wdc.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v2 5/6] package/uclibc: fix compilation errors X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Carlos Eduardo , Alistair Francis , Drew Fustini , Thomas Petazzoni , Romain Naour , Christoph Hellwig , Thomas De Schampheleire Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Add four patches to fix compilation errors when building static no MMU uclibc. The first two patches are upstream uclibc patches on top of version 1.0.35 tag. The following two patches are added here as additional fixes. Signed-off-by: Damien Le Moal --- ...evert-Fix-static-linking-with-GCC-10.patch | 43 ++++++++ ...0002-fix-static-builds-with-gcc-10.x.patch | 25 +++++ ...-utils-getconf-Fix-compilation-error.patch | 103 ++++++++++++++++++ .../0004-librt-avoid-compilation-error.patch | 42 +++++++ 4 files changed, 213 insertions(+) create mode 100644 package/uclibc/0001-Revert-Fix-static-linking-with-GCC-10.patch create mode 100644 package/uclibc/0002-fix-static-builds-with-gcc-10.x.patch create mode 100644 package/uclibc/0003-utils-getconf-Fix-compilation-error.patch create mode 100644 package/uclibc/0004-librt-avoid-compilation-error.patch diff --git a/package/uclibc/0001-Revert-Fix-static-linking-with-GCC-10.patch b/package/uclibc/0001-Revert-Fix-static-linking-with-GCC-10.patch new file mode 100644 index 0000000000..6adc827308 --- /dev/null +++ b/package/uclibc/0001-Revert-Fix-static-linking-with-GCC-10.patch @@ -0,0 +1,43 @@ +From e80384786d7b7f895c97f2447d4b91af8eb5f0f4 Mon Sep 17 00:00:00 2001 +From: Waldemar Brodkorb +Date: Wed, 2 Sep 2020 09:45:17 +0200 +Subject: [PATCH 1/4] Revert "Fix static linking with GCC-10" + +This reverts commit 5b58a1ebd89a4f05778441814e81817c82193fa3. + +This breaks all static builds earlier to gcc 10 :( +Bad testing on my side. +--- + libc/misc/elf/dl-support.c | 2 +- + libpthread/nptl/sysdeps/generic/libc-tls.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libc/misc/elf/dl-support.c b/libc/misc/elf/dl-support.c +index eaf08f5bb..87cd1bb72 100644 +--- a/libc/misc/elf/dl-support.c ++++ b/libc/misc/elf/dl-support.c +@@ -29,7 +29,7 @@ void (*_dl_init_static_tls) (struct link_map *) = &_dl_nothread_init_static_tls; + + ElfW(Phdr) *_dl_phdr; + size_t _dl_phnum; +-extern size_t _dl_pagesize; ++size_t _dl_pagesize; + + void internal_function _dl_aux_init (ElfW(auxv_t) *av); + void internal_function _dl_aux_init (ElfW(auxv_t) *av) +diff --git a/libpthread/nptl/sysdeps/generic/libc-tls.c b/libpthread/nptl/sysdeps/generic/libc-tls.c +index a1d2ef913..d746c9a38 100644 +--- a/libpthread/nptl/sysdeps/generic/libc-tls.c ++++ b/libpthread/nptl/sysdeps/generic/libc-tls.c +@@ -72,7 +72,7 @@ struct dtv_slotinfo_list *_dl_tls_dtv_slotinfo_list; + /* Number of modules in the static TLS block. */ + size_t _dl_tls_static_nelem; + /* Size of the static TLS block. */ +-extern size_t _dl_tls_static_size; ++size_t _dl_tls_static_size; + /* Size actually allocated in the static TLS block. */ + size_t _dl_tls_static_used; + /* Alignment requirement of the static TLS block. */ +-- +2.26.2 + diff --git a/package/uclibc/0002-fix-static-builds-with-gcc-10.x.patch b/package/uclibc/0002-fix-static-builds-with-gcc-10.x.patch new file mode 100644 index 0000000000..63d506c328 --- /dev/null +++ b/package/uclibc/0002-fix-static-builds-with-gcc-10.x.patch @@ -0,0 +1,25 @@ +From 4deace34cfcc5476b71a9cdc05828f5a48d1cd74 Mon Sep 17 00:00:00 2001 +From: Waldemar Brodkorb +Date: Thu, 3 Sep 2020 15:08:24 +0200 +Subject: [PATCH 2/4] fix static builds with gcc 10.x + +--- + Rules.mak | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Rules.mak b/Rules.mak +index f270b7bee..55e88d462 100644 +--- a/Rules.mak ++++ b/Rules.mak +@@ -288,7 +288,7 @@ OPTIMIZATION += $(CFLAG_-fstrict-aliasing) + + # Why -funsigned-char: I hunted a bug related to incorrect + # sign extension of 'char' type for 10 hours straight. Not fun. +-CPU_CFLAGS-y := -funsigned-char -fno-builtin ++CPU_CFLAGS-y := -funsigned-char -fno-builtin -fcommon + + $(eval $(call check-gcc-var,-fno-asm)) + CPU_CFLAGS-y += $(CFLAG_-fno-asm) +-- +2.26.2 + diff --git a/package/uclibc/0003-utils-getconf-Fix-compilation-error.patch b/package/uclibc/0003-utils-getconf-Fix-compilation-error.patch new file mode 100644 index 0000000000..2fc86d6161 --- /dev/null +++ b/package/uclibc/0003-utils-getconf-Fix-compilation-error.patch @@ -0,0 +1,103 @@ +From 684b80c97a38033cf0065537783ecf29bc2251ee Mon Sep 17 00:00:00 2001 +From: Damien Le Moal +Date: Mon, 7 Sep 2020 15:12:39 +0900 +Subject: [PATCH 3/4] utils/getconf: Fix compilation error + +Avoid "warning: statement will never be executed" compilation error if +none of the cases are defined. + +Signed-off-by: Damien Le Moal +--- + utils/getconf.c | 20 +++++++++++++++++--- + 1 file changed, 17 insertions(+), 3 deletions(-) + +diff --git a/utils/getconf.c b/utils/getconf.c +index 3dd3d75d9..b8d00f90f 100644 +--- a/utils/getconf.c ++++ b/utils/getconf.c +@@ -1154,7 +1154,6 @@ environment SPEC.\n\n"); + + const char *spec = NULL; + char buf[sizeof "POSIX_V6_LPBIG_OFFBIG"]; +- char *argv0 = argv[0]; + if (argc > 1 && strncmp (argv[1], "-v", 2) == 0) + { + if (argv[1][2] == '\0') +@@ -1199,42 +1198,56 @@ environment SPEC.\n\n"); + + switch (specs[i].num) + { ++#undef DO_GETCONF_NAME + #if !defined(_XBS5_ILP32_OFF32) && defined(_SC_XBS5_ILP32_OFF32) ++#define DO_GETCONF_NAME + case _SC_XBS5_ILP32_OFF32: + #endif + #if !defined(_XBS5_ILP32_OFFBIG) && defined(_SC_XBS5_ILP32_OFFBIG) ++#define DO_GETCONF_NAME + case _SC_XBS5_ILP32_OFFBIG: + #endif + #if !defined(_XBS5_LP64_OFF64) && defined(_SC_XBS5_LP64_OFF64) ++#define DO_GETCONF_NAME + case _SC_XBS5_LP64_OFF64: + #endif + #if !defined(_XBS5_LPBIG_OFFBIG) && defined(_SC_XBS5_LPBIG_OFFBIG) ++#define DO_GETCONF_NAME + case _SC_XBS5_LPBIG_OFFBIG: + #endif + #if !defined(_POSIX_V6_ILP32_OFF32) && defined(_SC_V6_ILP32_OFF32) ++#define DO_GETCONF_NAME + case _SC_V6_ILP32_OFF32: + #endif + #if !defined(_POSIX_V6_ILP32_OFFBIG) && defined(_SC_V6_ILP32_OFFBIG) ++#define DO_GETCONF_NAME + case _SC_V6_ILP32_OFFBIG: + #endif + #if !defined(_POSIX_V6_LP64_OFF64) && defined(_SC_V6_LP64_OFF64) ++#define DO_GETCONF_NAME + case _SC_V6_LP64_OFF64: + #endif + #if !defined(_POSIX_V6_LPBIG_OFFBIG) && defined(_SC_V6_LPBIG_OFFBIG) ++#define DO_GETCONF_NAME + case _SC_V6_LPBIG_OFFBIG: + #endif + #if !defined(_POSIX_V7_ILP32_OFF32) && defined(_SC_V7_ILP32_OFF32) ++#define DO_GETCONF_NAME + case _SC_V7_ILP32_OFF32: + #endif + #if !defined(_POSIX_V7_ILP32_OFFBIG) && defined(_SC_V7_ILP32_OFFBIG) ++#define DO_GETCONF_NAME + case _SC_V7_ILP32_OFFBIG: + #endif + #if !defined(_POSIX_V7_LP64_OFF64) && defined(_SC_V7_LP64_OFF64) ++#define DO_GETCONF_NAME + case _SC_V7_LP64_OFF64: + #endif + #if !defined(_POSIX_V7_LPBIG_OFFBIG) && defined(_SC_V7_LPBIG_OFFBIG) ++#define DO_GETCONF_NAME + case _SC_V7_LPBIG_OFFBIG: + #endif ++#ifdef DO_GETCONF_NAME + { + const char *args[argc + 3]; + size_t spec_len = strlen (spec); +@@ -1242,14 +1255,15 @@ environment SPEC.\n\n"); + memcpy (mempcpy (mempcpy (getconf_name, getconf_dir, + getconf_dirlen), + "/", 1), spec, spec_len + 1); +- args[0] = argv0; ++ args[0] = argv[0]; + args[1] = "-v"; + args[2] = spec; + memcpy (&args[3], &argv[1], argc * sizeof (argv[1])); + execv (getconf_name, (char * const *) args); + error (4, errno, _("Couldn't execute %s"), getconf_name); + } +- default: ++#endif ++ default: + break; + } + } +-- +2.26.2 + diff --git a/package/uclibc/0004-librt-avoid-compilation-error.patch b/package/uclibc/0004-librt-avoid-compilation-error.patch new file mode 100644 index 0000000000..c0b7177f58 --- /dev/null +++ b/package/uclibc/0004-librt-avoid-compilation-error.patch @@ -0,0 +1,42 @@ +From 4f7150086ffc2936d2c0f44e136984fcb232f7c7 Mon Sep 17 00:00:00 2001 +From: Damien Le Moal +Date: Mon, 7 Sep 2020 16:51:09 +0900 +Subject: [PATCH 4/4] librt: avoid compilation error + +For no MMU builds, LIBC_CANCEL_ASYNC and LIBC_CANCEL_RESET are not +defined. Prevent these to by visible by the compiler in +clock_nanosleep() by replacing "if (SINGLE_THREAD_P) {" with the +pre-compiler directive "#if defined(SINGLE_THREAD_P)". + +Signed-off-by: Damien Le Moal +--- + librt/clock_nanosleep.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/librt/clock_nanosleep.c b/librt/clock_nanosleep.c +index 4cf1e06b4..1515cf5b0 100644 +--- a/librt/clock_nanosleep.c ++++ b/librt/clock_nanosleep.c +@@ -36,9 +36,9 @@ clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req, + if (clock_id == CLOCK_PROCESS_CPUTIME_ID) + clock_id = MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED); + +- if (SINGLE_THREAD_P) ++#if defined(SINGLE_THREAD_P) + r = INTERNAL_SYSCALL (clock_nanosleep, err, 4, clock_id, flags, req, rem); +- else ++#else + { + int oldstate = LIBC_CANCEL_ASYNC (); + +@@ -47,6 +47,7 @@ clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req, + + LIBC_CANCEL_RESET (oldstate); + } ++#endif + + return (INTERNAL_SYSCALL_ERROR_P (r, err) + ? INTERNAL_SYSCALL_ERRNO (r, err) : 0); +-- +2.26.2 +