From patchwork Fri Nov 13 16:58:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 41066 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2E2E3394743A; Fri, 13 Nov 2020 16:59:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2E2E3394743A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1605286756; bh=x8biNJz6/aUBuBixY75wcgT3YhL/rm9G5NAoYuy+PN4=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=EEq4SPCCDWtk3lQun+H186BqzNo7+j8QelHC/alYtNjnkoAivqqQqRIW3FN04jQf7 rcnIJUYeSw0ON0wcB2pX9oIqAMQ/kwcDunloVGfFJiJssXJpHkTvMiykTGDKGmzAsT 8EOHlv0ZaTtcEjGkbD7Yz1YJ2kWWrAaNUSgJqY+o= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf33.google.com (mail-qv1-xf33.google.com [IPv6:2607:f8b0:4864:20::f33]) by sourceware.org (Postfix) with ESMTPS id A5DF33947425 for ; Fri, 13 Nov 2020 16:59:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A5DF33947425 Received: by mail-qv1-xf33.google.com with SMTP id b11so4901299qvr.9 for ; Fri, 13 Nov 2020 08:59:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x8biNJz6/aUBuBixY75wcgT3YhL/rm9G5NAoYuy+PN4=; b=hqDlCaLyCqYwjj3OYIB4u8phKDhYTUoVxlkBNuhIkhhNbmdCSUXl0ia92BYx43AZnr zzhP+OqAd0olqrTl7a9d97wNJXQcWbJprFYnf7fQTr/IAADogqg91UwW0LLoUB0tBuml 4Px1cAypbG/54v4WA+J0W0UGmN2UPY2MmhEkdvBQNWS4RuY8LOmgaHbreo21ltcF6MHb DrbeNPicDimPCQGzHRvbPORqiaujUvJlwFDpLjkb6Bv2GNX6Uv5oR3cJX7yPh+nGGomU mO7dGj0VaCvGzOcBwjS2b7muR7i2DjUyvS/dAIre+tiAtWZHPFsXvayuAHbsEtCkLq2V Ye7A== X-Gm-Message-State: AOAM531DB7lUdEVvuW8Xz9ctnam3ABzRcpc9DW3xmiLV933X0XK+asn3 TKvRlle/0p28rZqNRZaKiKaRW63z2bMqCA== X-Google-Smtp-Source: ABdhPJy+xhLz/S02KsoWslAPWXt1HFXKgU2JJdSxHNGAgN5aM8eAl7baKmcmogGbSEESKiiOueiQbA== X-Received: by 2002:a05:6214:9c4:: with SMTP id dp4mr2957851qvb.44.1605286748093; Fri, 13 Nov 2020 08:59:08 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id s16sm7363931qkg.5.2020.11.13.08.59.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Nov 2020 08:59:07 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH v2 18/23] linux: Use generic __syscall_error for csky Date: Fri, 13 Nov 2020 13:58:32 -0300 Message-Id: <20201113165837.121629-19-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201113165837.121629-1-adhemerval.zanella@linaro.org> References: <20201113165837.121629-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_BLACK autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Although the auto-generated syscall issue __syscall_error, using an inline function generates slight more compact code: --- sizes-csky-linux-gnuabiv2-soft.outline +++ sizes-csky-linux-gnuabiv2-soft.inline text data bss dec hex filename -1210010 10408 9212 1229630 12c33e libc.so - 121439 3876 184 125499 1ea3b elf/ld.so - 93074 920 8348 102342 18fc6 nptl/libpthread.so - 24971 648 156 25775 64af rt/librt.so +1209202 10408 9212 1228822 12c016 libc.so + 121171 3876 184 125231 1e92f elf/ld.so + 93630 920 8348 102898 191f2 nptl/libpthread.so + 24967 648 156 25771 64ab rt/librt.so Checked with a cross make check for csky-linux-gnuabiv2-soft. --- sysdeps/unix/sysv/linux/csky/abiv2/sysdep.S | 65 -------------------- sysdeps/unix/sysv/linux/csky/syscall_error.h | 25 ++++++++ 2 files changed, 25 insertions(+), 65 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/csky/abiv2/sysdep.S create mode 100644 sysdeps/unix/sysv/linux/csky/syscall_error.h diff --git a/sysdeps/unix/sysv/linux/csky/abiv2/sysdep.S b/sysdeps/unix/sysv/linux/csky/abiv2/sysdep.S deleted file mode 100644 index fe6b600bdc..0000000000 --- a/sysdeps/unix/sysv/linux/csky/abiv2/sysdep.S +++ /dev/null @@ -1,65 +0,0 @@ -/* syscall error handlers. C-SKY ABIV2 version. - Copyright (C) 2018-2020 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, see - . */ - -#include - -/* The syscall stubs jump here when they detect an error. - The code for Linux is almost identical to the canonical Unix - code, except that the error number in R0 is negated. */ - -#undef CALL_MCOUNT -#define CALL_MCOUNT /* Don't insert the profiling call, it clobbers R0. */ - - .text -ENTRY (__syscall_error) - movi a1, 0 - rsub a0, a0, a1 - -#if !IS_IN (rtld) - mov a1, a0 - mov a0, tls - - grs t1, .Lgetpc1 -.Lgetpc1: - lrw t0, errno@gottpoff - add t1, t1, t0 - ldw t1, (t1) - add t1, a0 - stw a1, (t1) - bmaski a0, 0 - rts -#elif RTLD_PRIVATE_ERRNO /* !IS_IN (rtld) */ -# ifdef __PIC__ - grs t1, .Lgetpc2 -.Lgetpc2: - lrw t0, .Lgetpc2@GOTPC - addu t1, t1, t0 - lrw t0, rtld_errno@PLT - ldr.w t0, (t1, t0 << 0) -# else - lrw t0, rtld_errno -# endif /* __PIC__ */ - stw a0, (t0) - bmaski a0, 0 - rts -#else -# error "Unsupported non-TLS case" -#endif /* RTLD_PRIVATE_ERRNO */ - -#undef __syscall_error -END (__syscall_error) diff --git a/sysdeps/unix/sysv/linux/csky/syscall_error.h b/sysdeps/unix/sysv/linux/csky/syscall_error.h new file mode 100644 index 0000000000..dbdd6ab44f --- /dev/null +++ b/sysdeps/unix/sysv/linux/csky/syscall_error.h @@ -0,0 +1,25 @@ +/* Linux wrappers for setting errno. CSKY version. + Copyright (C) 2020 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, see + . */ + +#ifndef _SYSCALL_ERROR_H +#define _SYSCALL_ERROR_H + +#define SYSCALL_ERROR_FUNC 1 +#define SYSCALL_ERROR_FUNC_ATTR + +#endif