From patchwork Fri Nov 13 16:58:34 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: 41068 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 479EA394743E; Fri, 13 Nov 2020 16:59:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 479EA394743E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1605286759; bh=OVh46OXkdIRSZo0zCB0/OZDkefuZA/xoIL47VBBdamw=; 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=d2IGyDdfl8gLKYOPJoj8htJMB7+aJa/W+H+VGBOs8aOkCMATdbRxzsdKNoIkPUZUp Y0TmretGKi41DGkYlyi0HSlZklhtNB00uunYR4dSE/rGcI2pdebGUJaZTqKArvhiwQ wfZg76a8FVQCfCV+gTo1N9j+NmLYszRNoqlLv+xo= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) by sourceware.org (Postfix) with ESMTPS id 4CF833947403 for ; Fri, 13 Nov 2020 16:59:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4CF833947403 Received: by mail-qk1-x741.google.com with SMTP id d9so9391051qke.8 for ; Fri, 13 Nov 2020 08:59:16 -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=OVh46OXkdIRSZo0zCB0/OZDkefuZA/xoIL47VBBdamw=; b=jCRcPO9T9mqGQ0tOJBmxedQKkLkJmliB+OPinymXIZ1/0/FIO5XA9gOaa6U5qCC3+c xVH/BZ7hpc6/taV4nBRHhy+y6Bp7FWTeJrqIAaqjlDmvxdx08kaTE8JtUJfMUenHKOYq DX5L9GyTbgs9zpsHuZxZ/dblHAlEFRCM0YFfdU8qRs0Zosu1la8aOeGCeLPmdBoz/1xd ddJVF+Toolp4lCJ2Zjl8utz/OPtnW6TY0+J8Lf61nShf2xP8lkGy4i9TIgZctXIeqOdq oIS2kUVEsVzWf9YFK1C3v/5RTpGwtq6aPzDYKCx4T1SFF6oRFMnCl1DwOiVqDNuEdLNw 7vLA== X-Gm-Message-State: AOAM530tnx/8qkk3pRCUm+AQlvaBVsvRO/WXEcIWrbAww+OaDziIanw6 vUu2PPkiNKcFuB67hNaq0UXxleLAeLH8Kg== X-Google-Smtp-Source: ABdhPJzbNAmgMDKUtrBVNMvTiCZwBbtuId/YwZf5Str5ml1EO4d20VYEw+3m0GprKbI6id7l0i2SjA== X-Received: by 2002:a37:a0c1:: with SMTP id j184mr2502988qke.364.1605286750773; Fri, 13 Nov 2020 08:59:10 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id s16sm7363931qkg.5.2020.11.13.08.59.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Nov 2020 08:59:10 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH v2 20/23] linux: Use generic __syscall_error for nios2 Date: Fri, 13 Nov 2020 13:58:34 -0300 Message-Id: <20201113165837.121629-21-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=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, 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" The usage of __syscall_error function on dynamic objects only increases the total size slightly: --- sizes-nios2-linux-gnu.inline +++ sizes-nios2-linux-gnu.outline text data bss dec hex filename -1425296 78844 9224 1513364 171794 libc.so - 143824 8138 184 152146 25252 elf/ld.so - 101762 9260 8356 119378 1d252 nptl/libpthread.so - 26183 2392 160 28735 703f rt/librt.so +1425592 80724 9224 1515540 172014 libc.so + 143960 8142 184 152286 252de elf/ld.so + 102278 10552 8356 121186 1d962 nptl/libpthread.so + 26175 2396 160 28731 703b rt/librt.so And since the port already issues the function call for static object it simplifies the implementation since it avoid add an arch-specific syscall_error.c. Checked with cross make check for nios2-linux-gnu. --- sysdeps/unix/sysv/linux/nios2/syscall_error.h | 25 ++++++++++ sysdeps/unix/sysv/linux/nios2/sysdep.S | 50 ------------------- 2 files changed, 25 insertions(+), 50 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/nios2/syscall_error.h delete mode 100644 sysdeps/unix/sysv/linux/nios2/sysdep.S diff --git a/sysdeps/unix/sysv/linux/nios2/syscall_error.h b/sysdeps/unix/sysv/linux/nios2/syscall_error.h new file mode 100644 index 0000000000..c13958a07d --- /dev/null +++ b/sysdeps/unix/sysv/linux/nios2/syscall_error.h @@ -0,0 +1,25 @@ +/* Linux wrappers for setting errno. NIOS2 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 diff --git a/sysdeps/unix/sysv/linux/nios2/sysdep.S b/sysdeps/unix/sysv/linux/nios2/sysdep.S deleted file mode 100644 index 6efbb5aff6..0000000000 --- a/sysdeps/unix/sysv/linux/nios2/sysdep.S +++ /dev/null @@ -1,50 +0,0 @@ -/* Static library error handling code fragment for Nios II. - Copyright (C) 2015-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 following code is only used in the static library. In the shared - library, the error handling code is at the end of each function. */ - -#ifndef PIC - -/* In the static library, the syscall stubs jump here when they detect - an error. */ - -# undef CALL_MCOUNT -# define CALL_MCOUNT /* Don't insert the profiling call, it clobbers r2. */ - -# if IS_IN (libc) -# define SYSCALL_ERROR_ERRNO __libc_errno -# else -# define SYSCALL_ERROR_ERRNO errno -# endif - .text -ENTRY (__syscall_error) - nextpc r3 -1: - movhi r8, %hiadj(_gp_got - 1b) - addi r8, r8, %lo(_gp_got - 1b) - add r3, r3, r8 - ldw r3, %tls_ie(SYSCALL_ERROR_ERRNO)(r3) - add r3, r23, r3 - stw r2, 0(r3) - movi r2, -1 - ret -END (__syscall_error) -#endif