From patchwork Fri Nov 13 16:58:20 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: 41054 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 A0D223945C04; Fri, 13 Nov 2020 16:58:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A0D223945C04 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1605286739; bh=qiHFKES/dlkNOEz4VgfCO4Rx2LcSqpsGMRJy2aNDdb0=; 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=uF1vfvRVkQ7eYOKj7+1+FZbZT2E6LUrT9gr228AhKRE9qUy52LKs8CrOiOGzCMjpy CwU5oDnYZU09V9uFOHqMvg83eovTXxszJMSk4v6L9QiZ7Sjor63V4H2ANwXAAyOdVJ 40mStqspljqSjb/kGqgOkB7UmCC2KXHgMO4lWzHc= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by sourceware.org (Postfix) with ESMTPS id A4A3439450D7 for ; Fri, 13 Nov 2020 16:58:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A4A3439450D7 Received: by mail-qk1-x743.google.com with SMTP id n132so9416920qke.1 for ; Fri, 13 Nov 2020 08:58:56 -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=qiHFKES/dlkNOEz4VgfCO4Rx2LcSqpsGMRJy2aNDdb0=; b=qtwXtqbWU7u9OLBcjDVu6w7fJWJm0RR/IHiyhvpWurK4lw0GFrjvhKmtx+ggWO+o0I q+98+LROOwj3Uv8K4qt+uMXdBli37nV3Zf9L+OWcLtkTHcnwsBy5CKglFcqdipOQSwaq rryliUNXjFidkXaNv7iu8C9kZlxgqX/Eg7P/z8F7oEtBi2i1VmFzfTHzt60FrdO6IiHL 9fXDV93lD9tPSxHAuAmBCwQQKAD8v5ePYoOQoINyr6YUbB/xM1AhvJHt75quYF99D//7 A0vbbZGXnN+mceSxNeK/8WdgdBVMtGvYB09Nuz1vKYcPqH2LQ6Ad2+9daGEa5LAUiopK rO+g== X-Gm-Message-State: AOAM531KjVJ/a7xaq2LPlsMSEKREZMduTbi+Sr/s5Ybt+x/pp66RM81p bLWJDJGhDM5D8fHhdDV3jc1wp4LkQO1/wA== X-Google-Smtp-Source: ABdhPJza6DeymY04SgRzJfoF/PNuOKSxwzqMi/1LuWj+PPH4eYL6Ij8/hHxnslxteRBVDIYE37zO3w== X-Received: by 2002:a37:58c6:: with SMTP id m189mr2983723qkb.129.1605286731061; Fri, 13 Nov 2020 08:58:51 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id s16sm7363931qkg.5.2020.11.13.08.58.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Nov 2020 08:58:50 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH v2 06/23] linux: Use generic __syscall_error for i386 Date: Fri, 13 Nov 2020 13:58:20 -0300 Message-Id: <20201113165837.121629-7-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 auto-generated syscalls calls the __syscall_error, and for i686 it results in much less compat code: --- sizes-i686-linux-gnu.outline +++ sizes-i686-linux-gnu.inline text data bss dec hex filename -1933727 11324 10172 1955223 1dd597 libc.so - 175366 4768 184 180318 2c05e elf/ld.so - 109851 832 8408 119091 1d133 nptl/libpthread.so - 27983 628 184 28795 707b rt/librt.so +1937875 11324 10172 1959371 1de5cb libc.so + 175790 4768 184 180742 2c206 elf/ld.so + 110179 832 8408 119419 1d27b nptl/libpthread.so + 28139 628 184 28951 7117 rt/librt.so This patch enabled SYSCALL_ERROR_FUNC with the expected abi by also defining SYSCALL_ERROR_FUNC_ATTR. Checked on i686-linux-gnu. --- sysdeps/unix/sysv/linux/i386/Makefile | 13 ------------ .../linux/i386/{sysdep.c => syscall_error.h} | 20 ++++++++----------- 2 files changed, 8 insertions(+), 25 deletions(-) rename sysdeps/unix/sysv/linux/i386/{sysdep.c => syscall_error.h} (67%) diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile index da716e2c1b..983b02e081 100644 --- a/sysdeps/unix/sysv/linux/i386/Makefile +++ b/sysdeps/unix/sysv/linux/i386/Makefile @@ -28,22 +28,9 @@ gen-as-const-headers += ucontext_i.sym endif ifeq ($(subdir),csu) -sysdep-dl-routines += sysdep ifeq (yes,$(build-shared)) sysdep_routines += divdi3 shared-only-routines += divdi3 CPPFLAGS-divdi3.c = -Din_divdi3_c endif endif - -ifeq ($(subdir),nptl) -# pull in __syscall_error routine -libpthread-routines += sysdep -libpthread-shared-only-routines += sysdep -endif - -ifeq ($(subdir),rt) -# pull in __syscall_error routine -librt-routines += sysdep -librt-shared-only-routines += sysdep -endif diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.c b/sysdeps/unix/sysv/linux/i386/syscall_error.h similarity index 67% rename from sysdeps/unix/sysv/linux/i386/sysdep.c rename to sysdeps/unix/sysv/linux/i386/syscall_error.h index e6228406dd..0b63c07a4e 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.c +++ b/sysdeps/unix/sysv/linux/i386/syscall_error.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2015-2020 Free Software Foundation, Inc. +/* Linux wrappers for setting errno. i386 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 @@ -15,15 +16,10 @@ License along with the GNU C Library; if not, see . */ -#include +#ifndef _SYSCALL_ERROR_H +#define _SYSCALL_ERROR_H -/* This routine is jumped to by all the syscall handlers, to stash - an error number into errno. ERROR is the negative error number - returned from the x86 kernel. */ -int -__attribute__ ((__regparm__ (1))) -__syscall_error (int error) -{ - __set_errno (-error); - return -1; -} +#define SYSCALL_ERROR_FUNC 1 +#define SYSCALL_ERROR_FUNC_ATTR __attribute__ ((__regparm__ (1))) + +#endif