From patchwork Mon Nov 9 20:18:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 40992 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 922DA3973077; Mon, 9 Nov 2020 20:18:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 922DA3973077 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1604953136; bh=y/1xZ/UyxF1Y0SWG3qLmCRC6jjiTZSNEeqtcs3noPUY=; 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=R27UBydsOVxs6tovh2/Mue9KVW9CU1+s6W+FfQ1wpPiCmXF6GcExOhUerIubmGlyJ J0Z2Ram7eOlouehGiea1zY4xWiXTt5mSLBpkFwXLb2/YMP/ee9WoKoRlMAjDh2GyPw MpbUHwLOaTysJ+o43931a0KtHB2RV7URmU6oFaCM= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) by sourceware.org (Postfix) with ESMTPS id 61BFB397304E for ; Mon, 9 Nov 2020 20:18:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 61BFB397304E Received: by mail-qt1-x841.google.com with SMTP id 3so6970084qtx.3 for ; Mon, 09 Nov 2020 12:18:53 -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=y/1xZ/UyxF1Y0SWG3qLmCRC6jjiTZSNEeqtcs3noPUY=; b=I+WmD9eHrnqjWF7to1AG1yNNjIENaKYK1aoYwl5LYHkVyFrbWNdgMg7j5lma9RyB19 oXjd2/V3oS5BTmo2+mKEWLNmViNma1kpT7HN9wCozCtCpzrtOtyZgnfygD2TV23mWOQs lgeW160YRQV5Bi9KZDO2D2yeacWhnS2sg4hkByOrJS1PkenmRk5oj2XFtvk4YVUzazji WdOlasCXsCMVlw2awjZvRsXvTOgnKN0pnRm6+NLWxjuG7h15yu1uKQUt6UhtZDi5YC6x ew8ct8ZjbzAORdSnrKIFXRhugWVb2cXWkhE7Bo8SDR70fla8gJBFMd1P/ApyyPOvqD/s QpiQ== X-Gm-Message-State: AOAM531B1cEaBAF0GAc1uL2dVsJKaG7eBs2FVbacLSOJZY9a2YaIUL3U etvA98vrDDhZKG03vxhJSgDPe2TetuCUpg== X-Google-Smtp-Source: ABdhPJzdcQOvb29Cfrw8mJkvijYB7ci4ZmIhawY7rckiOl1ikqCLcFhN8h8YyigFbo+dl6j+oAXOWg== X-Received: by 2002:ac8:5411:: with SMTP id b17mr14918878qtq.281.1604953132617; Mon, 09 Nov 2020 12:18:52 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id z2sm6843407qkl.22.2020.11.09.12.18.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Nov 2020 12:18:52 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 12/23] linux: Use generic __syscall_error for arm Date: Mon, 9 Nov 2020 17:18:15 -0300 Message-Id: <20201109201826.120534-13-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201109201826.120534-1-adhemerval.zanella@linaro.org> References: <20201109201826.120534-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 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 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 ---------------------------- sysdeps/unix/sysv/linux/arm/sysdep.S | 33 --------------- sysdeps/unix/sysv/linux/arm/sysdep.h | 2 + 3 files changed, 2 insertions(+), 95 deletions(-) delete mode 100644 sysdeps/unix/arm/sysdep.S delete mode 100644 sysdeps/unix/sysv/linux/arm/sysdep.S 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/sysdep.S deleted file mode 100644 index 94c877b31d..0000000000 --- a/sysdeps/unix/sysv/linux/arm/sysdep.S +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 1995-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 - - .text - -/* 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 diff --git a/sysdeps/unix/sysv/linux/arm/sysdep.h b/sysdeps/unix/sysv/linux/arm/sysdep.h index e2985cffd7..b771db4508 100644 --- a/sysdeps/unix/sysv/linux/arm/sysdep.h +++ b/sysdeps/unix/sysv/linux/arm/sysdep.h @@ -20,6 +20,8 @@ #ifndef _LINUX_ARM_SYSDEP_H #define _LINUX_ARM_SYSDEP_H 1 +#define SYSCALL_ERROR_FUNC + /* There is some commonality. */ #include #include