From patchwork Sat Jul 25 22:06:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Romain Naour X-Patchwork-Id: 1336345 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.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=N6qaaGWy; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BDgCM4FwQz9sRK for ; Sun, 26 Jul 2020 08:06:54 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 7775B87765; Sat, 25 Jul 2020 22:06:52 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Xs-ssTDmqt5Y; Sat, 25 Jul 2020 22:06:50 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 0F09486FA6; Sat, 25 Jul 2020 22:06:50 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 8A3931BF2AF for ; Sat, 25 Jul 2020 22:06:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 86FA985DB8 for ; Sat, 25 Jul 2020 22:06:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QXY0dl027qCK for ; Sat, 25 Jul 2020 22:06:48 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 1459D85DA5 for ; Sat, 25 Jul 2020 22:06:48 +0000 (UTC) Received: by mail-wr1-f65.google.com with SMTP id f7so11376355wrw.1 for ; Sat, 25 Jul 2020 15:06:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=T+ZP8DtAx/Csx2HZ3hQ8yBVSGSLzVNnnbJ+Bl7oatic=; b=N6qaaGWyg2WTazV6QTgWAY6YKL1kAGmTqcZJHl6FmobPVPgQoGCSDS0sD8GKWwet0M zb5OHpyIM+Vg9GoixftXdZ9LiNHanhtKZ6WHK7f45N5GP1tfCEtnAT4hEPaY6YEkC5ji remWC8dpM7G+UnwWs9y+qBv5uX7sCKjxCiNuDkV2/Jo+8RyVas6jwKo7jnBESWidB1AU m1RAJnrh6Q8CMg/xcnVhf9APbv56ISlvGJlJQbch+PypcXC8FCafoakYXPGOe7SX8QEv 2uh1UlsYfoQ0qHeyipArioFjBy2VLXRjzYpplAHWCCjXg1H5btO4hNZZ1Uy/m3uQ0nXa lt7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=T+ZP8DtAx/Csx2HZ3hQ8yBVSGSLzVNnnbJ+Bl7oatic=; b=PuWfCl0j+pb61oin+WxBc3IFDFthZBDkYLIqXRHa108lg9FHlFtNphcAuQXIwsDzz0 UvzPYi1exb/sxbK5RQJKGfsRXC5lWfY6eCnbKYa2uGsDth3J7IG/mbry6YY5Tr7sZG3r rSkCOCgqxFQkcgpHm079Z8MS7jGXrqPPvziISmkeJfXKW8sqzVzdOAp3erfKnWEtt223 i8jKP4lEX90uMg1wSU4SuoPxTuW5AYzHb8SSgNwIiKirD0kBhzQdMRbE+FMN5lWkPqAB HKKz159aVdZ161uhOLz1eh5ndHMotEvsyPUvWjcbeyx5LZhzrlj9xtAgo/jtQNZ2srUe 1I8Q== X-Gm-Message-State: AOAM530vzBo0ABNjjxwIpkpRKPgejgvEGDwZWdIEhVpN2kGbxy7w8eVI 7XHP5T8dZeJZmquHmOb9KVZGva0B X-Google-Smtp-Source: ABdhPJySR2asmwkTs1zpQneZ3xGHr4B/Oapeu4hWuUmDl1KF+Hc6uW4qyVY0Qx4ju/nu8ZYi6JG5QQ== X-Received: by 2002:a5d:400e:: with SMTP id n14mr9847082wrp.75.1595714804702; Sat, 25 Jul 2020 15:06:44 -0700 (PDT) Received: from localhost.localdomain (2a01cb058f8a18003dbee9eed79eb521.ipv6.abo.wanadoo.fr. [2a01:cb05:8f8a:1800:3dbe:e9ee:d79e:b521]) by smtp.gmail.com with ESMTPSA id q2sm2497316wro.8.2020.07.25.15.06.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Jul 2020 15:06:44 -0700 (PDT) From: Romain Naour To: buildroot@buildroot.org Date: Sun, 26 Jul 2020 00:06:39 +0200 Message-Id: <20200725220641.1370957-1-romain.naour@gmail.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Subject: [Buildroot] [PATCH v2 1/3] qemu_mips32r6: Do not include hi and lo in clobber list for R6 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: Romain Naour Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From [1] "GCC 10 (PR 91233) won't silently allow registers that are not architecturally available to be present in the clobber list anymore, resulting in build failure for mips*r6 targets in form of: ... .../sysdep.h:146:2: error: the register ‘lo’ cannot be clobbered in ‘asm’ for the current target 146 | __asm__ volatile ( \ | ^~~~~~~ This is because base R6 ISA doesn't define hi and lo registers w/o DSP extension. This patch provides the alternative clobber list for r6 targets that won't include those registers." Since kernel 5.4 and mips support for generic vDSO [2], the kernel fail to build for mips r6 cpus with gcc 10 for the same reason as glibc. [1] https://sourceware.org/git/?p=glibc.git;a=commit;h=020b2a97bb15f807c0482f0faee2184ed05bcad8 [2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=24640f233b466051ad3a5d2786d2951e43026c9d Fixes: https://gitlab.com/kubu93/buildroot/-/jobs/655618359 https://gitlab.com/kubu93/buildroot/-/jobs/655618360 Signed-off-by: Romain Naour --- v2: use MIPS_ISA_REV instead of __mips_isa_rev --- ...ude-hi-and-lo-in-clobber-list-for-R6.patch | 149 ++++++++++++++++++ ...ude-hi-and-lo-in-clobber-list-for-R6.patch | 149 ++++++++++++++++++ configs/qemu_mips32r6_malta_defconfig | 1 + configs/qemu_mips32r6el_malta_defconfig | 1 + 4 files changed, 300 insertions(+) create mode 100644 board/qemu/mips32r6-malta/patches/linux/0001-mips-Do-not-include-hi-and-lo-in-clobber-list-for-R6.patch create mode 100644 board/qemu/mips32r6el-malta/patches/linux/0001-mips-Do-not-include-hi-and-lo-in-clobber-list-for-R6.patch diff --git a/board/qemu/mips32r6-malta/patches/linux/0001-mips-Do-not-include-hi-and-lo-in-clobber-list-for-R6.patch b/board/qemu/mips32r6-malta/patches/linux/0001-mips-Do-not-include-hi-and-lo-in-clobber-list-for-R6.patch new file mode 100644 index 0000000000..801efb5d08 --- /dev/null +++ b/board/qemu/mips32r6-malta/patches/linux/0001-mips-Do-not-include-hi-and-lo-in-clobber-list-for-R6.patch @@ -0,0 +1,149 @@ +From bb04c220d82598066eeadf49defaec1157d4d206 Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Sat, 25 Jul 2020 11:46:01 +0200 +Subject: [PATCH] mips: Do not include hi and lo in clobber list for R6 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From [1] +"GCC 10 (PR 91233) won't silently allow registers that are not architecturally +available to be present in the clobber list anymore, resulting in build failure +for mips*r6 targets in form of: +... +.../sysdep.h:146:2: error: the register ‘lo’ cannot be clobbered in ‘asm’ for the current target + 146 | __asm__ volatile ( \ + | ^~~~~~~ + +This is because base R6 ISA doesn't define hi and lo registers w/o DSP extension. +This patch provides the alternative clobber list for r6 targets that won't include +those registers." + +Since kernel 5.4 and mips support for generic vDSO [2], the kernel fail to build +for mips r6 cpus with gcc 10 for the same reason as glibc. + +[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=020b2a97bb15f807c0482f0faee2184ed05bcad8 +[2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=24640f233b466051ad3a5d2786d2951e43026c9d + +Signed-off-by: Romain Naour +--- + arch/mips/include/asm/vdso/gettimeofday.h | 45 +++++++++++++++++++++++ + 1 file changed, 45 insertions(+) + +diff --git a/arch/mips/include/asm/vdso/gettimeofday.h b/arch/mips/include/asm/vdso/gettimeofday.h +index 0ae9b4cbc153..ea600e0ebfe7 100644 +--- a/arch/mips/include/asm/vdso/gettimeofday.h ++++ b/arch/mips/include/asm/vdso/gettimeofday.h +@@ -36,12 +36,21 @@ static __always_inline long gettimeofday_fallback( + register long nr asm("v0") = __NR_gettimeofday; + register long error asm("a3"); + ++#if MIPS_ISA_REV >= 6 ++ asm volatile( ++ " syscall\n" ++ : "=r" (ret), "=r" (error) ++ : "r" (tv), "r" (tz), "r" (nr) ++ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", ++ "$14", "$15", "$24", "$25", "memory"); ++#else + asm volatile( + " syscall\n" + : "=r" (ret), "=r" (error) + : "r" (tv), "r" (tz), "r" (nr) + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", + "$14", "$15", "$24", "$25", "hi", "lo", "memory"); ++#endif + + return error ? -ret : ret; + } +@@ -60,12 +69,21 @@ static __always_inline long clock_gettime_fallback( + #endif + register long error asm("a3"); + ++#if MIPS_ISA_REV >= 6 ++ asm volatile( ++ " syscall\n" ++ : "=r" (ret), "=r" (error) ++ : "r" (clkid), "r" (ts), "r" (nr) ++ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", ++ "$14", "$15", "$24", "$25", "memory"); ++#else + asm volatile( + " syscall\n" + : "=r" (ret), "=r" (error) + : "r" (clkid), "r" (ts), "r" (nr) + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", + "$14", "$15", "$24", "$25", "hi", "lo", "memory"); ++#endif + + return error ? -ret : ret; + } +@@ -84,12 +102,21 @@ static __always_inline int clock_getres_fallback( + #endif + register long error asm("a3"); + ++#if MIPS_ISA_REV >= 6 ++ asm volatile( ++ " syscall\n" ++ : "=r" (ret), "=r" (error) ++ : "r" (clkid), "r" (ts), "r" (nr) ++ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", ++ "$14", "$15", "$24", "$25", "memory"); ++#else + asm volatile( + " syscall\n" + : "=r" (ret), "=r" (error) + : "r" (clkid), "r" (ts), "r" (nr) + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", + "$14", "$15", "$24", "$25", "hi", "lo", "memory"); ++#endif + + return error ? -ret : ret; + } +@@ -108,12 +135,21 @@ static __always_inline long clock_gettime32_fallback( + register long nr asm("v0") = __NR_clock_gettime; + register long error asm("a3"); + ++#if MIPS_ISA_REV >= 6 ++ asm volatile( ++ " syscall\n" ++ : "=r" (ret), "=r" (error) ++ : "r" (clkid), "r" (ts), "r" (nr) ++ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", ++ "$14", "$15", "$24", "$25", "memory"); ++#else + asm volatile( + " syscall\n" + : "=r" (ret), "=r" (error) + : "r" (clkid), "r" (ts), "r" (nr) + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", + "$14", "$15", "$24", "$25", "hi", "lo", "memory"); ++#endif + + return error ? -ret : ret; + } +@@ -128,12 +164,21 @@ static __always_inline int clock_getres32_fallback( + register long nr asm("v0") = __NR_clock_getres; + register long error asm("a3"); + ++#if MIPS_ISA_REV >= 6 ++ asm volatile( ++ " syscall\n" ++ : "=r" (ret), "=r" (error) ++ : "r" (clkid), "r" (ts), "r" (nr) ++ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", ++ "$14", "$15", "$24", "$25", "memory"); ++#else + asm volatile( + " syscall\n" + : "=r" (ret), "=r" (error) + : "r" (clkid), "r" (ts), "r" (nr) + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", + "$14", "$15", "$24", "$25", "hi", "lo", "memory"); ++#endif + + return error ? -ret : ret; + } +-- +2.25.4 + diff --git a/board/qemu/mips32r6el-malta/patches/linux/0001-mips-Do-not-include-hi-and-lo-in-clobber-list-for-R6.patch b/board/qemu/mips32r6el-malta/patches/linux/0001-mips-Do-not-include-hi-and-lo-in-clobber-list-for-R6.patch new file mode 100644 index 0000000000..801efb5d08 --- /dev/null +++ b/board/qemu/mips32r6el-malta/patches/linux/0001-mips-Do-not-include-hi-and-lo-in-clobber-list-for-R6.patch @@ -0,0 +1,149 @@ +From bb04c220d82598066eeadf49defaec1157d4d206 Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Sat, 25 Jul 2020 11:46:01 +0200 +Subject: [PATCH] mips: Do not include hi and lo in clobber list for R6 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From [1] +"GCC 10 (PR 91233) won't silently allow registers that are not architecturally +available to be present in the clobber list anymore, resulting in build failure +for mips*r6 targets in form of: +... +.../sysdep.h:146:2: error: the register ‘lo’ cannot be clobbered in ‘asm’ for the current target + 146 | __asm__ volatile ( \ + | ^~~~~~~ + +This is because base R6 ISA doesn't define hi and lo registers w/o DSP extension. +This patch provides the alternative clobber list for r6 targets that won't include +those registers." + +Since kernel 5.4 and mips support for generic vDSO [2], the kernel fail to build +for mips r6 cpus with gcc 10 for the same reason as glibc. + +[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=020b2a97bb15f807c0482f0faee2184ed05bcad8 +[2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=24640f233b466051ad3a5d2786d2951e43026c9d + +Signed-off-by: Romain Naour +--- + arch/mips/include/asm/vdso/gettimeofday.h | 45 +++++++++++++++++++++++ + 1 file changed, 45 insertions(+) + +diff --git a/arch/mips/include/asm/vdso/gettimeofday.h b/arch/mips/include/asm/vdso/gettimeofday.h +index 0ae9b4cbc153..ea600e0ebfe7 100644 +--- a/arch/mips/include/asm/vdso/gettimeofday.h ++++ b/arch/mips/include/asm/vdso/gettimeofday.h +@@ -36,12 +36,21 @@ static __always_inline long gettimeofday_fallback( + register long nr asm("v0") = __NR_gettimeofday; + register long error asm("a3"); + ++#if MIPS_ISA_REV >= 6 ++ asm volatile( ++ " syscall\n" ++ : "=r" (ret), "=r" (error) ++ : "r" (tv), "r" (tz), "r" (nr) ++ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", ++ "$14", "$15", "$24", "$25", "memory"); ++#else + asm volatile( + " syscall\n" + : "=r" (ret), "=r" (error) + : "r" (tv), "r" (tz), "r" (nr) + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", + "$14", "$15", "$24", "$25", "hi", "lo", "memory"); ++#endif + + return error ? -ret : ret; + } +@@ -60,12 +69,21 @@ static __always_inline long clock_gettime_fallback( + #endif + register long error asm("a3"); + ++#if MIPS_ISA_REV >= 6 ++ asm volatile( ++ " syscall\n" ++ : "=r" (ret), "=r" (error) ++ : "r" (clkid), "r" (ts), "r" (nr) ++ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", ++ "$14", "$15", "$24", "$25", "memory"); ++#else + asm volatile( + " syscall\n" + : "=r" (ret), "=r" (error) + : "r" (clkid), "r" (ts), "r" (nr) + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", + "$14", "$15", "$24", "$25", "hi", "lo", "memory"); ++#endif + + return error ? -ret : ret; + } +@@ -84,12 +102,21 @@ static __always_inline int clock_getres_fallback( + #endif + register long error asm("a3"); + ++#if MIPS_ISA_REV >= 6 ++ asm volatile( ++ " syscall\n" ++ : "=r" (ret), "=r" (error) ++ : "r" (clkid), "r" (ts), "r" (nr) ++ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", ++ "$14", "$15", "$24", "$25", "memory"); ++#else + asm volatile( + " syscall\n" + : "=r" (ret), "=r" (error) + : "r" (clkid), "r" (ts), "r" (nr) + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", + "$14", "$15", "$24", "$25", "hi", "lo", "memory"); ++#endif + + return error ? -ret : ret; + } +@@ -108,12 +135,21 @@ static __always_inline long clock_gettime32_fallback( + register long nr asm("v0") = __NR_clock_gettime; + register long error asm("a3"); + ++#if MIPS_ISA_REV >= 6 ++ asm volatile( ++ " syscall\n" ++ : "=r" (ret), "=r" (error) ++ : "r" (clkid), "r" (ts), "r" (nr) ++ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", ++ "$14", "$15", "$24", "$25", "memory"); ++#else + asm volatile( + " syscall\n" + : "=r" (ret), "=r" (error) + : "r" (clkid), "r" (ts), "r" (nr) + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", + "$14", "$15", "$24", "$25", "hi", "lo", "memory"); ++#endif + + return error ? -ret : ret; + } +@@ -128,12 +164,21 @@ static __always_inline int clock_getres32_fallback( + register long nr asm("v0") = __NR_clock_getres; + register long error asm("a3"); + ++#if MIPS_ISA_REV >= 6 ++ asm volatile( ++ " syscall\n" ++ : "=r" (ret), "=r" (error) ++ : "r" (clkid), "r" (ts), "r" (nr) ++ : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", ++ "$14", "$15", "$24", "$25", "memory"); ++#else + asm volatile( + " syscall\n" + : "=r" (ret), "=r" (error) + : "r" (clkid), "r" (ts), "r" (nr) + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", + "$14", "$15", "$24", "$25", "hi", "lo", "memory"); ++#endif + + return error ? -ret : ret; + } +-- +2.25.4 + diff --git a/configs/qemu_mips32r6_malta_defconfig b/configs/qemu_mips32r6_malta_defconfig index 9fb0e0b04d..d0147b4ed9 100644 --- a/configs/qemu_mips32r6_malta_defconfig +++ b/configs/qemu_mips32r6_malta_defconfig @@ -23,6 +23,7 @@ BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.4.42" BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/mips32r6-malta/linux.config" BR2_LINUX_KERNEL_VMLINUX=y +BR2_GLOBAL_PATCH_DIR="board/qemu/mips32r6-malta/patches" # Serial port config BR2_TARGET_GENERIC_GETTY=y diff --git a/configs/qemu_mips32r6el_malta_defconfig b/configs/qemu_mips32r6el_malta_defconfig index efadd712b7..f240f869be 100644 --- a/configs/qemu_mips32r6el_malta_defconfig +++ b/configs/qemu_mips32r6el_malta_defconfig @@ -23,6 +23,7 @@ BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.4.42" BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/mips32r6el-malta/linux.config" BR2_LINUX_KERNEL_VMLINUX=y +BR2_GLOBAL_PATCH_DIR="board/qemu/mips32r6el-malta/patches" # Serial port config BR2_TARGET_GENERIC_GETTY=y