From patchwork Fri Nov 13 16:58:25 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: 41059 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 73AFD39450E7; Fri, 13 Nov 2020 16:59:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 73AFD39450E7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1605286746; bh=wDxhOkqNx5XFzCF8BG6uS8gAKfMKVIJqmesQZW0hRDY=; 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=I7V3I/SRHL8xwLWGRaAIEIdcP3n3oPnLHUZlwKhq8GabqyGM2cynr1Dgl6/XjB2f9 Gf8ORp+lOdbepeXpmR78RFI8nhyYXrojnOcyFtxh2cBEn9uPKEmYe2JHFpmNXGOStG o58Aj2EjuIsnd0Jyq6SrLJOuo/SrKY1GtZpmLmWw= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf42.google.com (mail-qv1-xf42.google.com [IPv6:2607:f8b0:4864:20::f42]) by sourceware.org (Postfix) with ESMTPS id 132793945060 for ; Fri, 13 Nov 2020 16:59:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 132793945060 Received: by mail-qv1-xf42.google.com with SMTP id e5so4912157qvs.1 for ; Fri, 13 Nov 2020 08:59:04 -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=wDxhOkqNx5XFzCF8BG6uS8gAKfMKVIJqmesQZW0hRDY=; b=hqzzJIDhHxeCfV8gImsvJ2Kn3ntTwUQISWgWhBPZ92Rf59o0hPxvFl+YY6Mty9Mrwr P+zB37Xnc+8jA0Ng7v1Y/k3RXVMAm0wiEwRy2dKkZMLEUI9GdCZei8SZMGcajYrjG7n5 fgW8Qufn/7U8Y4EB91exFQ4L62HYpVKrjS4lBahw4pB9K1DPM622oOf8aaCyM099PEyM M+a8M/ziygG02/Q0tCVWTJ78270gyMORXZEQ0iZEzmX4NP8KUJ+Lb6OZLdpOYNrGbhtV REgzh54Zmuy+XsiBWJRGEFtQIfK3WQ8p4q2HD1syT2WySBGdGl7JRCG6iKDnUE7NFnWv 7/wA== X-Gm-Message-State: AOAM531+aUkCC6eFID0xxo8C4DcUEsseamc19We5XhUbBbegY6SLGmgm dmumEKAAHQZ3bLGWu6P89OoFEGqDGnzogA== X-Google-Smtp-Source: ABdhPJw+Ec0jX1eESaW6qkbYpIGnJmcBlhOr64DhOpw5xVjW4i9RCkFS3JeW+pcCPw/hpX2OdCGntw== X-Received: by 2002:a0c:f585:: with SMTP id k5mr3311321qvm.13.1605286738367; Fri, 13 Nov 2020 08:58:58 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id s16sm7363931qkg.5.2020.11.13.08.58.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Nov 2020 08:58:57 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH v2 11/23] linux: Use generic __syscall_error for arm Date: Fri, 13 Nov 2020 13:58:25 -0300 Message-Id: <20201113165837.121629-12-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.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, KAM_STOCKGEN, 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 auto-generated syscalls issue the __syscall_erro and the ARM resulting binary using inline __syscall_error results in a large code size: --- sizes-arm-linux-gnueabihf.outline +++ sizes-arm-linux-gnueabihf.inline @@ -1,5 +1,5 @@ text data bss dec hex filename -1260061 9912 9256 1279229 1384fd libc.so - 143107 4336 208 147651 240c3 elf/ld.so - 97335 844 8352 106531 1a023 nptl/libpthread.so - 22516 656 160 23332 5b24 rt/librt.so +1265565 9912 9256 1284733 139a7d libc.so + 143491 4336 208 148035 24243 elf/ld.so + 98103 844 8352 107299 1a323 nptl/libpthread.so + 22996 656 160 23812 5d04 rt/librt.so The assembly sysdep.S is replaced the by the generic syscall_error.c. Checked on arm-linux-gnueabihf. --- sysdeps/unix/arm/sysdep.S | 62 ------------------- .../linux/arm/{sysdep.S => syscall_error.h} | 24 +++---- 2 files changed, 8 insertions(+), 78 deletions(-) delete mode 100644 sysdeps/unix/arm/sysdep.S rename sysdeps/unix/sysv/linux/arm/{sysdep.S => syscall_error.h} (55%) diff --git a/sysdeps/unix/arm/sysdep.S b/sysdeps/unix/arm/sysdep.S deleted file mode 100644 index 5c9022a869..0000000000 --- a/sysdeps/unix/arm/sysdep.S +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright (C) 1991-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 -#include - -#if IS_IN (rtld) -# include /* Defines RTLD_PRIVATE_ERRNO. */ -#endif - -#include - -#undef syscall_error -__syscall_error: -#if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN - /* We translate the system's EWOULDBLOCK error into EAGAIN. - The GNU C library always defines EWOULDBLOCK==EAGAIN. - EWOULDBLOCK_sys is the original number. */ - cmp r0, $EWOULDBLOCK_sys /* Is it the old EWOULDBLOCK? */ - it eq - moveq r0, $EAGAIN /* Yes; translate it to EAGAIN. */ -#endif - -#if !IS_IN (rtld) - mov r1, r0 - GET_TLS (r2) - ldr r2, 1f -#ifdef __thumb__ -2: add r2, r2, pc - ldr r2, [r2] -#else -2: ldr r2, [pc, r2] -#endif - str r1, [r0, r2] - mvn r0, #0 - DO_RET(lr) - -1: .word errno(gottpoff) + (. - 2b - PC_OFS) -#elif RTLD_PRIVATE_ERRNO - LDST_PCREL(str, r0, r1, C_SYMBOL_NAME(rtld_errno)) - mvn r0, #0 - DO_RET(r14) -#else -#error "Unsupported non-TLS case" -#endif - -#undef __syscall_error -END (__syscall_error) diff --git a/sysdeps/unix/sysv/linux/arm/sysdep.S b/sysdeps/unix/sysv/linux/arm/syscall_error.h similarity index 55% rename from sysdeps/unix/sysv/linux/arm/sysdep.S rename to sysdeps/unix/sysv/linux/arm/syscall_error.h index 94c877b31d..71f74e2bd3 100644 --- a/sysdeps/unix/sysv/linux/arm/sysdep.S +++ b/sysdeps/unix/sysv/linux/arm/syscall_error.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1995-2020 Free Software Foundation, Inc. +/* Linux wrappers for setting errno. ARM 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 @@ -12,22 +13,13 @@ 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 + License along with the GNU C Library; if not, see . */ -#include +#ifndef _SYSCALL_ERROR_H +#define _SYSCALL_ERROR_H - .text +#define SYSCALL_ERROR_FUNC 1 +#define SYSCALL_ERROR_FUNC_ATTR -/* 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. */ - -ENTRY (__syscall_error) - rsb r0, r0, $0 - -#define __syscall_error __syscall_error_1 -#include +#endif