From patchwork Thu Oct 20 18:25:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 59216 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 91C4C384D174 for ; Thu, 20 Oct 2022 18:26:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 91C4C384D174 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290401; bh=cE7nS5rdXxjP7mT+w3bW+W506NudyDr+QamFyq5EGNw=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=vrmN6xWlNt/cHNBfIznZXw6d3vWNhuk87q3iMw1KjaH1HbJQhUBP2sksZWRgzV6wB AGzohKHSo/iR3LGZvztcSh5NUB+4c2Q2em4JofkGB3w3ycgTW/PSCirpxeqya4Z09E YU7toY+/jNTN9vYFNv575aO800pRq5AtWswvZ38Q= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by sourceware.org (Postfix) with ESMTPS id 4A8A3384D177 for ; Thu, 20 Oct 2022 18:26:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4A8A3384D177 Received: by mail-pg1-x52d.google.com with SMTP id h185so277624pgc.10 for ; Thu, 20 Oct 2022 11:26:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cE7nS5rdXxjP7mT+w3bW+W506NudyDr+QamFyq5EGNw=; b=CYdp2ntEyCy9n1hgNSJXhrjEwUYSh5IA+SA77e4a1Lr014m44CWfFCHKqo9N8/i3kZ DhGrZek+lM4sO3n+O/VSkht0imLbBTiF9i1BBuH2r0coiv6iOdMTFKIwUp3sRgQgabY5 EPx9G9VTwEEvrqKC4bjBixoXkMT8jAVD3KZH+e8JYdsmlbe36HMmZy7wW4PMOtnzPPgh VWa679GQlueJSgStccQfROsN9PvJIM4W6L3aJa2JpfSCAUQoWCzfPDuxO+5zfaf6xKQp Mktb/Spo8ewPujhxtkud5LKHo2uNkQH2Qsz29MP+FUDN4J5Mz0d0U15berhn2J0n0Vi/ o5mg== X-Gm-Message-State: ACrzQf3CYExb8uUQRi53HD/craYEnNT545Ew2WY5pmYsXgHYkUWDY0MA h4bMHUjKDXrOR2MclamjLQ23QV+FhrFehw== X-Google-Smtp-Source: AMsMyM40dAMW9Zdx4n6lER9GcGLMkIQuKhDESFqeUe0wHE/BnKLHkDKwO/Rw9J1SLbQ8ge6xhdjPPw== X-Received: by 2002:a62:164d:0:b0:562:bc4e:253 with SMTP id 74-20020a62164d000000b00562bc4e0253mr14809186pfw.26.1666290381697; Thu, 20 Oct 2022 11:26:21 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.26.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:26:20 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 01/25] Rename 'hello2.spec.' -> 'hello2.spec' 'hello3.spec.' -> 'hello3.spec' Date: Fri, 21 Oct 2022 02:25:40 +0800 Message-Id: <20221020182603.815-2-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yonggang Luo via Elfutils-devel From: Yonggang Luo Reply-To: Yonggang Luo Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" These filenames are invalid on win32 Signed-off-by: Yonggang Luo --- tests/Makefile.am | 2 +- tests/debuginfod-rpms/{hello2.spec. => hello2.spec} | 0 tests/debuginfod-rpms/{hello3.spec. => hello3.spec} | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename tests/debuginfod-rpms/{hello2.spec. => hello2.spec} (100%) rename tests/debuginfod-rpms/{hello3.spec. => hello3.spec} (100%) diff --git a/tests/Makefile.am b/tests/Makefile.am index f680d3e1..4add00d8 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -566,7 +566,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \ debuginfod-rpms/fedora31/hello3-debugsource-1.0-2.x86_64.rpm \ debuginfod-rpms/fedora31/hello3-two-1.0-2.x86_64.rpm \ debuginfod-rpms/fedora31/hello3-two-debuginfo-1.0-2.x86_64.rpm \ - debuginfod-rpms/hello2.spec. \ + debuginfod-rpms/hello2.spec \ debuginfod-rpms/rhel6/hello2-1.0-2.i686.rpm \ debuginfod-rpms/rhel6/hello2-1.0-2.src.rpm \ debuginfod-rpms/rhel6/hello2-debuginfo-1.0-2.i686.rpm \ diff --git a/tests/debuginfod-rpms/hello2.spec. b/tests/debuginfod-rpms/hello2.spec similarity index 100% rename from tests/debuginfod-rpms/hello2.spec. rename to tests/debuginfod-rpms/hello2.spec diff --git a/tests/debuginfod-rpms/hello3.spec. b/tests/debuginfod-rpms/hello3.spec similarity index 100% rename from tests/debuginfod-rpms/hello3.spec. rename to tests/debuginfod-rpms/hello3.spec From patchwork Thu Oct 20 18:25:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 59215 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 396D0384C004 for ; Thu, 20 Oct 2022 18:26:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 396D0384C004 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290395; bh=qM4So6YABubYcR+0piUuwtFGebD9wou9UCkx+C6maSs=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=rA0HBNKJ+lcLmlMjeNaAj9Fsc/YRkCnT2FDl/k9bDrC4tzeYBdCtPKQzvCVdoCeiM rUMHoB3v2nLTy46YqLdrCl7xbmg7zhDbwwVXtVKnuPbIWuKpI+D0ng/WnCyRJ5AWkn KSslbruKTXCqSy4tn6kq0cbEGb0TYIgMyjPXwMl4= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id BB839384D156 for ; Thu, 20 Oct 2022 18:26:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BB839384D156 Received: by mail-pf1-x42f.google.com with SMTP id y191so359622pfb.2 for ; Thu, 20 Oct 2022 11:26:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qM4So6YABubYcR+0piUuwtFGebD9wou9UCkx+C6maSs=; b=wUViTbq3Vr0B0Y4n/nfmWJPA4hlOfTtXXks7/4Ozxsmq+0BcLJGjpLgmtBYTx/VixR DfMVmAUM3yM3Y8zHjtjVyMf1hrcJi/LmIN00cyFQ7LPGiB86aHewbxtcoDe3BDbMfQvM lOzQ8L9Os6ixLIfi6AOblbGhGVyaOitYjpGBdgtyKD3FECWODFE4y5/aj2jM4ANrta6/ boSeEfJwXSXU+mnklULJI52qJExg7VsnTYrxU+B7pM7m8pkNjOAwL6ssypgT87N9TTz4 K/kuZWaijj/CdJ7di6IWzQ0Xg7CyO+rN6AX+MzWHCECVSWISXin4h5P4+k9CTcbTYGGm AMPA== X-Gm-Message-State: ACrzQf1vuoCi5Ga7SEVl+uaEt0BZqRwGVsAt/VCWh2oIS5zuCsrHUQb6 KzEIqvKERjXqilg8wBsFsl7yQp3yd5ouFw== X-Google-Smtp-Source: AMsMyM7Tr5mlr+EANAc4qx4VOEHAawFHvs+7Uc4FDtUowOpnXuAUlASNCPjcX5WHw+qZB9V+V4EIOA== X-Received: by 2002:a05:6a00:16c1:b0:563:177f:99ee with SMTP id l1-20020a056a0016c100b00563177f99eemr15410423pfc.7.1666290384189; Thu, 20 Oct 2022 11:26:24 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.26.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:26:23 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 02/25] ignore build directory Date: Fri, 21 Oct 2022 02:25:41 +0800 Message-Id: <20221020182603.815-3-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yonggang Luo via Elfutils-devel From: Yonggang Luo Reply-To: Yonggang Luo Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Signed-off-by: Yonggang Luo --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 8bcd88d7..ca06dddd 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ Makefile.in /INSTALL /aclocal.m4 /autom4te.* +/build /config.cache /config.h /config.h.in From patchwork Thu Oct 20 18:25:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 59220 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 D69B4384B80F for ; Thu, 20 Oct 2022 18:26:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D69B4384B80F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290413; bh=ftuHCYlj2PTuc9R7KrdGV7/RxcfBSZ6D83w7cpnRehM=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=OWSZfo7151BBSsmF8ElKgO4GyEEbmk8+qvLYnnzTjWwdT+BXyBADWc+3Ta0mkEpXB CdCI1TbdfGK9VKN4R4r817M30acOz9fuYkg168Nk0cRkAvqWtgyhB2K/dN9EoM7lIe FO3tqDP++AUQqbZ3hhxJdYnHhGwtLX7aqeitNIuU= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id BBAC8386547E for ; Thu, 20 Oct 2022 18:26:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BBAC8386547E Received: by mail-pf1-x42e.google.com with SMTP id p14so343350pfq.5 for ; Thu, 20 Oct 2022 11:26:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ftuHCYlj2PTuc9R7KrdGV7/RxcfBSZ6D83w7cpnRehM=; b=jP0g1BLndF2EfJIJkiB5U88c+6LuizMzrhB8VZ6e9n5WjYvtDd230x7zj+hA5GaOSx e0moZr/YWhD9sThOdIXcxqBV5FReBXMZno83fjKZdcP0+W81Y1a/hsxclDTzfzMD0uP4 H+FrzTmHX3F6g1KjvrTRohSDlNbkywW7+IlXop9UfVmrp6mDpGWYK4s2wbc2r23+W1/o nglkW0mr0rtyuSJq2jbTAEQrwUEfrA7PbsEGShVemGf79AEnJ1uuJ2po8U7rr5FbMeem 8Zh1j/3SO7ioJV8NDlqLPG0tDRvOSKKd1wSq0Qo4d4XniLrb7zd9/ADrOCtkVt48MfQY qUeg== X-Gm-Message-State: ACrzQf0VETLhRQxBinXdmpF/dWMf0JzMlG/8iCGXLF7htZmzucF5Ta1t Xyk3IRQkvU1QoZrsH6dpwwu6/B3r8LBbcw== X-Google-Smtp-Source: AMsMyM7ZyncWnTxzntPxSQTA3F3OOjoVnrrHyRko/QPjovt6DOGpzSFRcUjIdmej78b13FcQ9iyd4A== X-Received: by 2002:a63:1923:0:b0:441:2c12:f704 with SMTP id z35-20020a631923000000b004412c12f704mr13164240pgl.398.1666290386407; Thu, 20 Oct 2022 11:26:26 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.26.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:26:25 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 03/25] libebl: There is no need #include in eblclosebackend.c and eblopenbackend.c Date: Fri, 21 Oct 2022 02:25:42 +0800 Message-Id: <20221020182603.815-4-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yonggang Luo via Elfutils-devel From: Yonggang Luo Reply-To: Yonggang Luo Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" It's not accessed symbols in dlfcn.h in eblclosebackend.c and eblopenbackend.c Signed-off-by: Yonggang Luo --- libebl/eblclosebackend.c | 1 - libebl/eblopenbackend.c | 1 - 2 files changed, 2 deletions(-) diff --git a/libebl/eblclosebackend.c b/libebl/eblclosebackend.c index 501e5c7b..7fa068ec 100644 --- a/libebl/eblclosebackend.c +++ b/libebl/eblclosebackend.c @@ -30,7 +30,6 @@ # include #endif -#include #include #include diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c index c6657252..02f80653 100644 --- a/libebl/eblopenbackend.c +++ b/libebl/eblopenbackend.c @@ -31,7 +31,6 @@ #endif #include -#include #include #include #include From patchwork Thu Oct 20 18:25:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 59218 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 0C0DE384B126 for ; Thu, 20 Oct 2022 18:26:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0C0DE384B126 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290406; bh=YvggxQ5bqpOZ456EtJDrAoFkZtwF0WEgtwQpIjMcG54=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=k1FvQZGx8qzZ097NQg5VAxst3Q2uRpwHrDbEa07U6ed2Wz1qUj6YtJfk1Ec0cq/OW K3EdxEBDCijRDkMKH6ZBMVre8KUYjxQWoy3uWdvCVw32kzAAH+xsL5kyuMsfQFJepB QG9VOzZ8iCaHD5GCPGN/6xqgDTbc5jGm+trKFFB4= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by sourceware.org (Postfix) with ESMTPS id 18A843865C23 for ; Thu, 20 Oct 2022 18:26:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 18A843865C23 Received: by mail-pj1-x102e.google.com with SMTP id f8-20020a17090a664800b00212464cd49fso406144pjm.4 for ; Thu, 20 Oct 2022 11:26:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YvggxQ5bqpOZ456EtJDrAoFkZtwF0WEgtwQpIjMcG54=; b=HChr/43LaDXvrzhhP4kwwjnPcvH95RbO21TeuHJsNczDlI7cBhI9atRUXfvJJaGdFs gCrS8rOtX4xABhupb12Hu9HrSNJnb/STlx+xMCN9BIxHec7eeQOrffsicZLrTJ7LDxvg LSMNQ7jCeFVMYvUMy+0BuR1GbIJWL9jYuZ+rhsqjmfrtZYEBB/yfE06nyuHcbwtC6nS/ 8DlIrzA+rVUCQdQtVmgCnLwkU3TRQaCOSaxooasxqDX43rCFw9evd8H7JtPPbMoUB0oR /dvvWJqEPoeGrEVzUCjdhlIvMYwK4Oo78JHSF0H1Q9Q15uNi5CX1mi1gqjTSD1OxyS+K 9GPg== X-Gm-Message-State: ACrzQf2qXJayoCiC9ECuf1zm5wBR5fSM9Gwe8erVbYg0u15l1rWCksjd md1ByFMvWQ3wpVFpsTK54VzhGTPtXUhsPg== X-Google-Smtp-Source: AMsMyM7Z3MRZuBl36ZkRwozS6lXW8ceX/S9hz8NMFT16pHHjS/SEHXOWUeFD8M749KsUrO94efYJtw== X-Received: by 2002:a17:903:18b:b0:185:43e6:20df with SMTP id z11-20020a170903018b00b0018543e620dfmr14907931plg.4.1666290388740; Thu, 20 Oct 2022 11:26:28 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.26.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:26:27 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 04/25] libelf/libdwfl: Remove "#define LIB_SYSTEM_H 1" in libelf_crc32.c and libdwfl_crc32.c Date: Fri, 21 Oct 2022 02:25:43 +0800 Message-Id: <20221020182603.815-5-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yonggang Luo via Elfutils-devel From: Yonggang Luo Reply-To: Yonggang Luo Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" rationale: https://sourceware.org/bugzilla/show_bug.cgi?id=21001 If we don't remove this macro, when try #include in libdw/memory-access.h wont' take effect because "#define LIB_SYSTEM_H 1" The compile error: ./../libdw/memory-access.h:390:12: error: implicit declaration of function ‘bswap_32’ [-Werror=implicit-function-declaration] Signed-off-by: Yonggang Luo --- libdwfl/libdwfl_crc32.c | 1 - libelf/libelf_crc32.c | 1 - 2 files changed, 2 deletions(-) diff --git a/libdwfl/libdwfl_crc32.c b/libdwfl/libdwfl_crc32.c index b89d0d36..5bc7a4ad 100644 --- a/libdwfl/libdwfl_crc32.c +++ b/libdwfl/libdwfl_crc32.c @@ -30,6 +30,5 @@ #endif #define crc32 attribute_hidden __libdwfl_crc32 -#define LIB_SYSTEM_H 1 #include #include "../lib/crc32.c" diff --git a/libelf/libelf_crc32.c b/libelf/libelf_crc32.c index 1426faf1..f1cf4868 100644 --- a/libelf/libelf_crc32.c +++ b/libelf/libelf_crc32.c @@ -30,6 +30,5 @@ #endif #define crc32 attribute_hidden __libelf_crc32 -#define LIB_SYSTEM_H 1 #include #include "../lib/crc32.c" From patchwork Thu Oct 20 18:25:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 59224 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 4A26E3865C2C for ; Thu, 20 Oct 2022 18:27:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4A26E3865C2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290427; bh=4bj2/768rdzqKPH4gbDajyyZM0na29aZY9tWXbw3IfQ=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=O83v6EnPmeR8S00o6JbqQUwxpTN8WVs/nCoQhgaSK4hDjWOmj8c7imlqYIVptoX9s LH+QOM8AI7rQznL0FBWXaJrmplLqR+vm8alRFC4sF52mcNfJQkiuv89twG/ZQ6d+m0 WWGFM/frCevIx/54OCo/bS/m/I1iqrPqFTogD/DU= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by sourceware.org (Postfix) with ESMTPS id 3F2F7384BC20 for ; Thu, 20 Oct 2022 18:26:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3F2F7384BC20 Received: by mail-pj1-x102e.google.com with SMTP id q10-20020a17090a304a00b0020b1d5f6975so481365pjl.0 for ; Thu, 20 Oct 2022 11:26:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4bj2/768rdzqKPH4gbDajyyZM0na29aZY9tWXbw3IfQ=; b=3ztgCJY0OKdkLJ3bF7ivJLAGuBanU7Udyfav5XHZtvIVtVL5TK6N0W5b2kI9E9EKrb 0QAn4KrO5/NCNWtY+bjod2rJQh8EfH6sG0W7MDDS+pRMW1ZJEgyaqz8JF6+6ngNw8yIA n8T7E1yMpQo3rJs32opTS7I3w70O4Z2Uq8vY12BoTK+JVuuVpCWIdSWgGWASOnKAgkxZ QshVIVb2FKUrnEkyNES/SjrScG7Qaw6oJ6wzGwVYfz/T//H3d9oPfsMMujDs5+q9lMYq EFKv+CD+glTD85kJQI9o0Bb4sNoWrD1mcA5KiKJ04ZkFJ+THhocC/cBzdixcwLI7LlLE 8nVw== X-Gm-Message-State: ACrzQf1D1y93v3PVUMnszvSTWYzsic2FHj9dXV0AUBxdP2xFJfHxQ3JE bx3QPkUeh7ACNHPpSjL3l+jyldyKbw/bLQ== X-Google-Smtp-Source: AMsMyM5Vz/1Rbo0U5z0k3+otQF59z1agzr62Y3s4g/jtxPrruZTMF28z8p4yQ+QvFZvisMKqk/x9NQ== X-Received: by 2002:a17:902:d484:b0:17f:7437:565d with SMTP id c4-20020a170902d48400b0017f7437565dmr15127322plg.154.1666290390927; Thu, 20 Oct 2022 11:26:30 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.26.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:26:30 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 05/25] use #include instead platform depended header in libdw/memory-access.h Date: Fri, 21 Oct 2022 02:25:44 +0800 Message-Id: <20221020182603.815-6-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yonggang Luo via Elfutils-devel From: Yonggang Luo Reply-To: Yonggang Luo Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Signed-off-by: Yonggang Luo --- libdw/memory-access.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libdw/memory-access.h b/libdw/memory-access.h index 800b517c..16c8c851 100644 --- a/libdw/memory-access.h +++ b/libdw/memory-access.h @@ -29,11 +29,10 @@ #ifndef _MEMORY_ACCESS_H #define _MEMORY_ACCESS_H 1 -#include -#include #include #include +#include /* Number decoding macros. See 7.6 Variable Length Data. */ From patchwork Thu Oct 20 18:25:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 59217 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 94D933865483 for ; Thu, 20 Oct 2022 18:26:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 94D933865483 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290404; bh=WFh8wbMIzkHUy5M0JBghNcNJW8d0FP+lkGcS8mwp3YI=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=tfaKaFqjd2jpYtRlAN9Unyal3AnEsD20mJ1tRVGOUDJoPxveQLcTKvjaCIXjjNSFT RDtfYU6NH4KoN5muugEn9OCQRE1tJGwBXlHgGNTLGuVqtwE4TUqVthls1Dlpd7mhHb CjwVfCdbKfmfvQbYTTyyzpog77Lgq0xVRxxCI6qE= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by sourceware.org (Postfix) with ESMTPS id A847B384D170 for ; Thu, 20 Oct 2022 18:26:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A847B384D170 Received: by mail-pj1-x1031.google.com with SMTP id o17-20020a17090aac1100b0020d98b0c0f4so4299623pjq.4 for ; Thu, 20 Oct 2022 11:26:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WFh8wbMIzkHUy5M0JBghNcNJW8d0FP+lkGcS8mwp3YI=; b=JuvyGPnLljX/7feOAoLueJCkBnrUjy0+6XHxEg1oLYz4lZdYRi4dCdNFMWsbbJzGuR M6OYYesEC6JVbN0N9r+7lQCl/YfuJIURRvKFhlkcMofG5gKQG/Yk3aUPTse+F5CCI2KO Ymf/4vOwPyggpo/wLSg3Wu+GUj1gsYiPN+cEMOcDD2bUeGvwdwnIKRxjUueghHEtWJpX 3eDixoVwtc7uIlmeRpnw1IHO2geacg2oGAIeaCH4+Fm8tdv/kqD2dew/+6xNzclodau3 MBfg5McBVmnDACI15OXbJ15QJwCBto1NwjUme4sEle8FhEWObkffwDidKoMyhsg/K3bf ZObQ== X-Gm-Message-State: ACrzQf3PlM4igGrS66Xlo1m9PJgizOXsc2ZipREikEbmwQ+rbMxu0WkQ 2jF1h5v3ud1/9VuvIAmFlpA+Mc/FWSHhRw== X-Google-Smtp-Source: AMsMyM4q+vGkdu1gSeeWY1LTqt6bbRwSxSXSCSFYL5WTQwQUsHTa2kECugaeIXvQjUmIZMSDJsD1Vg== X-Received: by 2002:a17:90b:4c52:b0:20d:489b:5607 with SMTP id np18-20020a17090b4c5200b0020d489b5607mr17354384pjb.40.1666290393110; Thu, 20 Oct 2022 11:26:33 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.26.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:26:32 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 06/25] move platform depended include into system.h of libebl Date: Fri, 21 Oct 2022 02:25:45 +0800 Message-Id: <20221020182603.815-7-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yonggang Luo via Elfutils-devel From: Yonggang Luo Reply-To: Yonggang Luo Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Because all source in libebl #include , so #include in libeblP.h is enough, there is multiple memory-access.h file, so use relative path to include it properly, Signed-off-by: Yonggang Luo -#include -#include #include #include #include + #include #define AUXV_TYPES \ diff --git a/libebl/eblcorenote.c b/libebl/eblcorenote.c index 7fab3974..9573e93e 100644 --- a/libebl/eblcorenote.c +++ b/libebl/eblcorenote.c @@ -31,12 +31,11 @@ #endif #include -#include -#include #include #include #include #include + #include diff --git a/libebl/ebldynamictagname.c b/libebl/ebldynamictagname.c index 5d4a3a58..018a2ff7 100644 --- a/libebl/ebldynamictagname.c +++ b/libebl/ebldynamictagname.c @@ -33,8 +33,8 @@ #include #include + #include -#include "system.h" const char * diff --git a/libebl/eblobjnote.c b/libebl/eblobjnote.c index 5a7c5c62..83ac4f47 100644 --- a/libebl/eblobjnote.c +++ b/libebl/eblobjnote.c @@ -35,13 +35,13 @@ #include #include #include -#include -#include "common.h" -#include "libelfP.h" -#include "libdwP.h" -#include "memory-access.h" +#include +#include "../libelf/common.h" +#include "../libelf/libelfP.h" +#include "../libdw/libdwP.h" +#include "../libdw/memory-access.h" void ebl_object_note (Ebl *ebl, uint32_t namesz, const char *name, uint32_t type, diff --git a/libebl/eblobjnotetypename.c b/libebl/eblobjnotetypename.c index 473a1f2f..c15379d6 100644 --- a/libebl/eblobjnotetypename.c +++ b/libebl/eblobjnotetypename.c @@ -31,11 +31,10 @@ # include #endif -#include - #include #include #include + #include diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c index 02f80653..7dc760d8 100644 --- a/libebl/eblopenbackend.c +++ b/libebl/eblopenbackend.c @@ -31,15 +31,15 @@ #endif #include -#include #include #include #include #include -#include #include +#include "../libelf/libelfP.h" + Ebl *i386_init (Elf *, GElf_Half, Ebl *); Ebl *sh_init (Elf *, GElf_Half, Ebl *); Ebl *x86_64_init (Elf *, GElf_Half, Ebl *); diff --git a/libebl/eblresolvesym.c b/libebl/eblresolvesym.c index 470f6f06..b859bba3 100644 --- a/libebl/eblresolvesym.c +++ b/libebl/eblresolvesym.c @@ -30,9 +30,10 @@ # include #endif -#include #include +#include + bool ebl_resolve_sym_value (Ebl *ebl, GElf_Addr *addr) { diff --git a/libebl/libeblP.h b/libebl/libeblP.h index c408ed97..14cb70f3 100644 --- a/libebl/libeblP.h +++ b/libebl/libeblP.h @@ -30,9 +30,11 @@ #define _LIBEBLP_H 1 #include -#include #include +#include + +#include <../libasm/libasm.h> /* Backend handle. */ struct ebl From patchwork Thu Oct 20 18:25:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 59219 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 F0875384B81F for ; Thu, 20 Oct 2022 18:26:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F0875384B81F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290409; bh=2oTBvKWwajscl3/NopDbsnH8O/rKmw1Gh8vRSZH5rc4=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=Wh7NrJUjVUng7263cZH2mxGKHQ+qEozFlXOg9No3RP3c+IrDHilJUDXt5G6WI+x/T CP75Zqjt16z29wvVFS9P7qlYN9kdgRLITx/YYZdZ4aNP6Fca9va31JYJ9lmrT67JNB Ojkw4BD2YqOhsf/DpufLWqyZI0te3YlV7S6CEBkc= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by sourceware.org (Postfix) with ESMTPS id E8DA0384D17E for ; Thu, 20 Oct 2022 18:26:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E8DA0384D17E Received: by mail-pl1-x631.google.com with SMTP id l4so89592plb.8 for ; Thu, 20 Oct 2022 11:26:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2oTBvKWwajscl3/NopDbsnH8O/rKmw1Gh8vRSZH5rc4=; b=u21ETmXj9EwqqKv/IGsn15QXqVCYmASpA9mZVHaJIJHtDNCLkwYZvnZ9bShekNSOMi PQRDcoh7Mc8/0KbsWr8PxvWtQ+t6mpnMQJ+cK5TI2bON1yUZVAFwtli/n6wMFVvFfWqy UiIrEgcWZ/SZNeJBhOWb9lWVzxMbZyl90NkBv+JitLPT7zYXYQZ13xWnyNQ9Caaj7Irx 4S2Ytq4JSV4Pgka7sdDTmsXWYvkVeWUFBmkNZUQNimZmrdjvS3Ka4HlEqe8ZwNtcayGz aWjWutEgxhYDbMzTHkiSFlseTDar3HfHr25kL2Flu35wx0duye+ACf4lLn+LGfTXlW0d 5IaA== X-Gm-Message-State: ACrzQf2SVX58UZ215kE9Gb5z2worxUnaR5BHUprZwRPL/5ycOMthpnUv CWKNkEJx08kE+bS0SVszw1LxGmkwTSLgxA== X-Google-Smtp-Source: AMsMyM4zgrR4DdXSOjJMDItfsJmTc317RbSRIO/QzFaOoIX3MHrcNeNHyww0BxnDrPUn4zC4Wr3Xsg== X-Received: by 2002:a17:902:8f91:b0:184:d3ed:afd8 with SMTP id z17-20020a1709028f9100b00184d3edafd8mr15232532plo.15.1666290395348; Thu, 20 Oct 2022 11:26:35 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.26.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:26:34 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 07/25] move platform depended include into system.h of libasm, libcpu, libdw, libdwfl and libdwelf Date: Fri, 21 Oct 2022 02:25:46 +0800 Message-Id: <20221020182603.815-8-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yonggang Luo via Elfutils-devel From: Yonggang Luo Reply-To: Yonggang Luo Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Signed-off-by: Yonggang Luo --- lib/color.c | 1 - libasm/asm_abort.c | 1 - libasm/asm_addint8.c | 2 -- libasm/asm_begin.c | 2 -- libasm/asm_end.c | 2 -- libasm/libasmP.h | 3 +++ libcpu/i386_disasm.c | 1 - libcpu/memory-access.h | 3 +-- libdw/dwarf_begin_elf.c | 2 -- libdw/dwarf_end.c | 1 - libdw/dwarf_setalt.c | 2 -- libdw/libdw_find_split_unit.c | 1 - libdwelf/dwelf_elf_begin.c | 2 -- libdwelf/dwelf_strtab.c | 1 - libdwfl/argp-std.c | 1 - libdwfl/core-file.c | 6 ------ libdwfl/dwfl_build_id_find_debuginfo.c | 2 -- libdwfl/dwfl_build_id_find_elf.c | 1 - libdwfl/dwfl_end.c | 1 - libdwfl/dwfl_frame.c | 1 - libdwfl/dwfl_module.c | 1 - libdwfl/dwfl_module_getdwarf.c | 1 - libdwfl/dwfl_report_elf.c | 2 -- libdwfl/dwfl_segment_report_module.c | 2 -- libdwfl/find-debuginfo.c | 1 - libdwfl/gzip.c | 2 -- libdwfl/image-header.c | 4 ---- libdwfl/link_map.c | 2 -- libdwfl/linux-pid-attach.c | 1 - libdwfl/offline.c | 1 - libdwfl/open.c | 2 -- 31 files changed, 4 insertions(+), 51 deletions(-) diff --git a/lib/color.c b/lib/color.c index bd105ec2..8063dc26 100644 --- a/lib/color.c +++ b/lib/color.c @@ -34,7 +34,6 @@ #include #include #include -#include #include "system.h" #include "libeu.h" #include "color.h" diff --git a/libasm/asm_abort.c b/libasm/asm_abort.c index 12743dc6..696298c4 100644 --- a/libasm/asm_abort.c +++ b/libasm/asm_abort.c @@ -32,7 +32,6 @@ #endif #include -#include #include #include diff --git a/libasm/asm_addint8.c b/libasm/asm_addint8.c index bb7d40f2..7f823e09 100644 --- a/libasm/asm_addint8.c +++ b/libasm/asm_addint8.c @@ -31,8 +31,6 @@ # include #endif -#include -#include #include #include diff --git a/libasm/asm_begin.c b/libasm/asm_begin.c index a190202c..9e4dfe43 100644 --- a/libasm/asm_begin.c +++ b/libasm/asm_begin.c @@ -37,11 +37,9 @@ #include #include #include -#include #include #include "libasmP.h" -#include static AsmCtx_t * diff --git a/libasm/asm_end.c b/libasm/asm_end.c index a26120f2..c06d2366 100644 --- a/libasm/asm_end.c +++ b/libasm/asm_end.c @@ -35,12 +35,10 @@ #include #include #include -#include #include #include #include -#include static int diff --git a/libasm/libasmP.h b/libasm/libasmP.h index 5b5fb776..11f42511 100644 --- a/libasm/libasmP.h +++ b/libasm/libasmP.h @@ -32,6 +32,9 @@ #include #include + +#include + #include "libebl.h" #include "libdwelf.h" diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c index 40475b81..599d1654 100644 --- a/libcpu/i386_disasm.c +++ b/libcpu/i386_disasm.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include diff --git a/libcpu/memory-access.h b/libcpu/memory-access.h index 3b6ca19b..6e92fc5b 100644 --- a/libcpu/memory-access.h +++ b/libcpu/memory-access.h @@ -29,11 +29,10 @@ #ifndef _MEMORY_ACCESS_H #define _MEMORY_ACCESS_H 1 -#include -#include #include #include +#include /* When loading this file we require the macro MACHINE_ENCODING to be defined to signal the endianness of the architecture which is diff --git a/libdw/dwarf_begin_elf.c b/libdw/dwarf_begin_elf.c index a48dada6..8fcef335 100644 --- a/libdw/dwarf_begin_elf.c +++ b/libdw/dwarf_begin_elf.c @@ -38,11 +38,9 @@ #include #include #include -#include #include #include #include -#include #include "libelfP.h" #include "libdwP.h" diff --git a/libdw/dwarf_end.c b/libdw/dwarf_end.c index 77f537a7..8dd075cf 100644 --- a/libdw/dwarf_end.c +++ b/libdw/dwarf_end.c @@ -35,7 +35,6 @@ #include #include #include -#include #include "libdwP.h" #include "cfi.h" diff --git a/libdw/dwarf_setalt.c b/libdw/dwarf_setalt.c index 9051b8e0..dc9b61cb 100644 --- a/libdw/dwarf_setalt.c +++ b/libdw/dwarf_setalt.c @@ -32,8 +32,6 @@ #include "libdwP.h" -#include - void dwarf_setalt (Dwarf *main, Dwarf *alt) { diff --git a/libdw/libdw_find_split_unit.c b/libdw/libdw_find_split_unit.c index da039e50..a22e7bc9 100644 --- a/libdw/libdw_find_split_unit.c +++ b/libdw/libdw_find_split_unit.c @@ -40,7 +40,6 @@ #include #include #include -#include void try_split_file (Dwarf_CU *cu, const char *dwo_path) diff --git a/libdwelf/dwelf_elf_begin.c b/libdwelf/dwelf_elf_begin.c index c3cfe633..17a90fc9 100644 --- a/libdwelf/dwelf_elf_begin.c +++ b/libdwelf/dwelf_elf_begin.c @@ -34,8 +34,6 @@ #include "libdwflP.h" #include "libelfP.h" -#include - NEW_VERSION (dwelf_elf_begin, ELFUTILS_0.177) Elf * dwelf_elf_begin (int fd) diff --git a/libdwelf/dwelf_strtab.c b/libdwelf/dwelf_strtab.c index 5ec8c295..c95f9467 100644 --- a/libdwelf/dwelf_strtab.c +++ b/libdwelf/dwelf_strtab.c @@ -37,7 +37,6 @@ #include #include #include -#include #include "libdwelfP.h" #include diff --git a/libdwfl/argp-std.c b/libdwfl/argp-std.c index bc013aa0..1605fbfe 100644 --- a/libdwfl/argp-std.c +++ b/libdwfl/argp-std.c @@ -35,7 +35,6 @@ #include #include #include -#include #define OPT_DEBUGINFO 0x100 diff --git a/libdwfl/core-file.c b/libdwfl/core-file.c index 4418ef33..cd9b4f38 100644 --- a/libdwfl/core-file.c +++ b/libdwfl/core-file.c @@ -33,12 +33,6 @@ #include "libdwflP.h" #include -#include -#include -#include -#include "system.h" - - /* On failure return, we update *NEXT to point back at OFFSET. */ static inline Elf * do_fail (int error, off_t *next, off_t offset) diff --git a/libdwfl/dwfl_build_id_find_debuginfo.c b/libdwfl/dwfl_build_id_find_debuginfo.c index 273e5e5f..856f2312 100644 --- a/libdwfl/dwfl_build_id_find_debuginfo.c +++ b/libdwfl/dwfl_build_id_find_debuginfo.c @@ -31,8 +31,6 @@ #endif #include "libdwflP.h" -#include - int dwfl_build_id_find_debuginfo (Dwfl_Module *mod, diff --git a/libdwfl/dwfl_build_id_find_elf.c b/libdwfl/dwfl_build_id_find_elf.c index 7b604d47..35bc8c9e 100644 --- a/libdwfl/dwfl_build_id_find_elf.c +++ b/libdwfl/dwfl_build_id_find_elf.c @@ -33,7 +33,6 @@ #include "libdwflP.h" #include #include -#include #include "system.h" diff --git a/libdwfl/dwfl_end.c b/libdwfl/dwfl_end.c index b1840191..a1812407 100644 --- a/libdwfl/dwfl_end.c +++ b/libdwfl/dwfl_end.c @@ -31,7 +31,6 @@ #endif #include "libdwflP.h" -#include void dwfl_end (Dwfl *dwfl) diff --git a/libdwfl/dwfl_frame.c b/libdwfl/dwfl_frame.c index 77e0c5cb..5ee71dd4 100644 --- a/libdwfl/dwfl_frame.c +++ b/libdwfl/dwfl_frame.c @@ -33,7 +33,6 @@ #include #include "libdwflP.h" -#include /* Set STATE->pc_set from STATE->regs according to the backend. Return true on success, false on error. */ diff --git a/libdwfl/dwfl_module.c b/libdwfl/dwfl_module.c index e7dfdace..4fbff33e 100644 --- a/libdwfl/dwfl_module.c +++ b/libdwfl/dwfl_module.c @@ -33,7 +33,6 @@ #include "libdwflP.h" #include "../libdw/cfi.h" #include -#include static void free_cu (struct dwfl_cu *cu) diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c index 6f076057..498c7cd2 100644 --- a/libdwfl/dwfl_module_getdwarf.c +++ b/libdwfl/dwfl_module_getdwarf.c @@ -34,7 +34,6 @@ #include #include #include -#include #include "../libdw/libdwP.h" /* DWARF_E_* values are here. */ #include "../libelf/libelfP.h" #include "system.h" diff --git a/libdwfl/dwfl_report_elf.c b/libdwfl/dwfl_report_elf.c index a5f0e5e5..581f4079 100644 --- a/libdwfl/dwfl_report_elf.c +++ b/libdwfl/dwfl_report_elf.c @@ -32,8 +32,6 @@ #include "libdwflP.h" #include -#include - /* We start every ET_REL module at a moderately aligned boundary. This keeps the low addresses easy to read compared to a layout diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c index 28f87f10..287fc002 100644 --- a/libdwfl/dwfl_segment_report_module.c +++ b/libdwfl/dwfl_segment_report_module.c @@ -36,8 +36,6 @@ #include #include #include -#include -#include #include #include diff --git a/libdwfl/find-debuginfo.c b/libdwfl/find-debuginfo.c index 449df5a1..7f7ab632 100644 --- a/libdwfl/find-debuginfo.c +++ b/libdwfl/find-debuginfo.c @@ -33,7 +33,6 @@ #include "libdwflP.h" #include #include -#include #include #include "system.h" diff --git a/libdwfl/gzip.c b/libdwfl/gzip.c index ba8ecfba..53013be3 100644 --- a/libdwfl/gzip.c +++ b/libdwfl/gzip.c @@ -33,8 +33,6 @@ #include "libdwflP.h" #include "system.h" -#include - #ifdef LZMA # define USE_INFLATE 1 # include diff --git a/libdwfl/image-header.c b/libdwfl/image-header.c index f906068a..c777cc84 100644 --- a/libdwfl/image-header.c +++ b/libdwfl/image-header.c @@ -32,10 +32,6 @@ #endif #include "libdwflP.h" -#include "system.h" - -#include -#include #if BYTE_ORDER == LITTLE_ENDIAN # define LE16(x) (x) diff --git a/libdwfl/link_map.c b/libdwfl/link_map.c index c0207cd3..7ec7eca1 100644 --- a/libdwfl/link_map.c +++ b/libdwfl/link_map.c @@ -32,8 +32,6 @@ #include "../libdw/memory-access.h" #include "system.h" -#include -#include #include /* This element is always provided and always has a constant value. diff --git a/libdwfl/linux-pid-attach.c b/libdwfl/linux-pid-attach.c index 09cba07b..de867857 100644 --- a/libdwfl/linux-pid-attach.c +++ b/libdwfl/linux-pid-attach.c @@ -38,7 +38,6 @@ #include #include #include -#include #ifdef __linux__ diff --git a/libdwfl/offline.c b/libdwfl/offline.c index 499663e3..e090b42b 100644 --- a/libdwfl/offline.c +++ b/libdwfl/offline.c @@ -34,7 +34,6 @@ #include "libdwflP.h" #include -#include /* Since dwfl_report_elf lays out the sections already, this will only be called when the section headers of the debuginfo file are being diff --git a/libdwfl/open.c b/libdwfl/open.c index da8b59a3..68b755cd 100644 --- a/libdwfl/open.c +++ b/libdwfl/open.c @@ -35,8 +35,6 @@ #undef _ #include "libdwflP.h" -#include - #if !USE_BZLIB # define __libdw_bunzip2(...) DWFL_E_BADELF #endif From patchwork Thu Oct 20 18:25:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 59221 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 4261B384D171 for ; Thu, 20 Oct 2022 18:27:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4261B384D171 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290421; bh=uBTW2cWd9xOnKFiRZuIQaiEKXSIvNtrFYGz1TralyqY=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=F029SAZ/uoaRI/mB3CuY9A0DSxNKWm1mBWZWS9LKxpfZ3FNPYNfFtfnQitC0pRFrz sL6t3i/qNO+4GbN1EMGgvFa5WpLETWPpyj6kSZ60rZuuggeTrDON3G3ulIqiGQkthf Q/KHWCAwZP+fdyBIDNG14TeeGxsibOSMxiODG9UM= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by sourceware.org (Postfix) with ESMTPS id E5EEC384D15D for ; Thu, 20 Oct 2022 18:26:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E5EEC384D15D Received: by mail-pj1-x1031.google.com with SMTP id a6-20020a17090abe0600b0020d7c0c6650so4365998pjs.0 for ; Thu, 20 Oct 2022 11:26:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uBTW2cWd9xOnKFiRZuIQaiEKXSIvNtrFYGz1TralyqY=; b=FF8GgNsS9nqDVZZgJtSccS7l7/9ea/pE3rkCkgBlo42hlMIthwtG8Yth2yUStkDp7Z 6Y6tn2mxwQGpzlTrfW7KxlwIXBA043rKXzNN7PmFnzPEK3Tr3k9NPMQyGAQrOKPCuqxd Cvbq2gjECAT1o/VABispV6xQzh4KezeO19VkOcDSpvqVZUaEA5sTjZOtRw7OlTUWH6S2 F6Ogqok5pUqwbtIQLrS3Tqawp9HajYRGa7wkzmpQkngkaFrbHs+lUfZJ5zT0AMKyFaXR LQv5T9pPU/jAU204VLzirC+cCKawOmZxZueVkhpORyZ9fctzXk1Q1Ayr5I15PG0ts4li sFjQ== X-Gm-Message-State: ACrzQf3llvsJzDd7CmrDISyMNgDSdd8+GVEVdhq1BU27CTlFcb5rhhNy o1ztVlRy9OaOAtkdU0fG89rcueEQ8aA2vw== X-Google-Smtp-Source: AMsMyM73MriPzjd1zyfkAXc56Z06Wfo1o0QdkiqbkeZzgEQssUYWgqo4hB79mg++v8GJDlQRCvTJ3w== X-Received: by 2002:a17:903:11cd:b0:170:cde8:18b7 with SMTP id q13-20020a17090311cd00b00170cde818b7mr15231547plh.165.1666290397514; Thu, 20 Oct 2022 11:26:37 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.26.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:26:36 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 08/25] Use configure to detect HAVE_DECL_MMAP and use it for system doesn't provide sys/mman.h Date: Fri, 21 Oct 2022 02:25:47 +0800 Message-Id: <20221020182603.815-9-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yonggang Luo via Elfutils-devel From: Yonggang Luo Reply-To: Yonggang Luo Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Signed-off-by: Yonggang Luo --- configure.ac | 1 + lib/crc32_file.c | 4 ++-- lib/system.h | 2 ++ libelf/elf32_updatefile.c | 3 ++- libelf/elf_begin.c | 5 ++++- libelf/elf_end.c | 2 ++ libelf/elf_update.c | 5 ++++- 7 files changed, 17 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 03b67a9d..63aeb748 100644 --- a/configure.ac +++ b/configure.ac @@ -428,6 +428,7 @@ AC_CHECK_DECLS([memrchr, rawmemchr],[],[], [#define _GNU_SOURCE #include ]) AC_CHECK_DECLS([powerof2],[],[],[#include ]) +AC_CHECK_DECLS([mmap],[],[],[#include ]) AC_CHECK_DECLS([mempcpy],[],[], [#define _GNU_SOURCE #include ]) diff --git a/lib/crc32_file.c b/lib/crc32_file.c index f7607d0b..66833702 100644 --- a/lib/crc32_file.c +++ b/lib/crc32_file.c @@ -32,9 +32,7 @@ #include "libeu.h" #include -#include #include -#include #include "system.h" int @@ -45,6 +43,7 @@ crc32_file (int fd, uint32_t *resp) off_t off = 0; ssize_t count; +#if HAVE_DECL_MMAP struct stat st; if (fstat (fd, &st) == 0) { @@ -78,6 +77,7 @@ crc32_file (int fd, uint32_t *resp) munmap (mapped, mapsize); } } +#endif while ((count = TEMP_FAILURE_RETRY (pread (fd, buffer, sizeof buffer, off))) > 0) diff --git a/lib/system.h b/lib/system.h index bbbe06c4..561d3e03 100644 --- a/lib/system.h +++ b/lib/system.h @@ -42,7 +42,9 @@ /* System dependend headers */ #include #include +#if HAVE_DECL_MMAP #include +#endif #include #include diff --git a/libelf/elf32_updatefile.c b/libelf/elf32_updatefile.c index 46afa1f4..8229fd26 100644 --- a/libelf/elf32_updatefile.c +++ b/libelf/elf32_updatefile.c @@ -96,7 +96,7 @@ sort_sections (Elf_Scn **scns, Elf_ScnList *list) qsort (scns, scnp - scns, sizeof (*scns), compare_sections); } - +#if HAVE_DECL_MMAP static inline void fill_mmap (size_t offset, char *last_position, char *scn_start, char *const shdr_start, char *const shdr_end) @@ -482,6 +482,7 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum) return 0; } +#endif /* Size of the buffer we use to generate the blocks of fill bytes. */ diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c index fe8c640a..6d31882e 100644 --- a/libelf/elf_begin.c +++ b/libelf/elf_begin.c @@ -645,10 +645,12 @@ static struct Elf * read_file (int fildes, int64_t offset, size_t maxsize, Elf_Cmd cmd, Elf *parent) { +#if HAVE_DECL_MMAP void *map_address = NULL; int use_mmap = (cmd == ELF_C_READ_MMAP || cmd == ELF_C_RDWR_MMAP || cmd == ELF_C_WRITE_MMAP || cmd == ELF_C_READ_MMAP_PRIVATE); +#endif if (parent == NULL) { @@ -669,7 +671,7 @@ read_file (int fildes, int64_t offset, size_t maxsize, /* The parent is already loaded. Use it. */ assert (maxsize != ~((size_t) 0)); } - +#if HAVE_DECL_MMAP if (use_mmap) { if (parent == NULL) @@ -713,6 +715,7 @@ read_file (int fildes, int64_t offset, size_t maxsize, return result; } +#endif /* Otherwise we have to do it the hard way. We read as much as necessary from the file whenever we need information which is not available. */ diff --git a/libelf/elf_end.c b/libelf/elf_end.c index 5c451f36..8023b216 100644 --- a/libelf/elf_end.c +++ b/libelf/elf_end.c @@ -222,8 +222,10 @@ elf_end (Elf *elf) /* The file was read or mapped for this descriptor. */ if ((elf->flags & ELF_F_MALLOCED) != 0) free (elf->map_address); +#if HAVE_DECL_MMAP else if ((elf->flags & ELF_F_MMAPPED) != 0) munmap (elf->map_address, elf->maximum_size); +#endif } rwlock_unlock (elf->lock); diff --git a/libelf/elf_update.c b/libelf/elf_update.c index 56af3a1c..e81eb6c9 100644 --- a/libelf/elf_update.c +++ b/libelf/elf_update.c @@ -64,7 +64,7 @@ write_file (Elf *elf, int64_t size, int change_bo, size_t shnum) __libelf_seterrno (ELF_E_WRITE_ERROR); return -1; } - +#if HAVE_DECL_MMAP /* Try to map the file if this isn't done yet. */ if (elf->map_address == NULL && elf->cmd == ELF_C_WRITE_MMAP) { @@ -125,6 +125,7 @@ write_file (Elf *elf, int64_t size, int change_bo, size_t shnum) size = -1; } else +#endif { /* The file is not mmaped. */ if ((class == ELFCLASS32 @@ -145,6 +146,7 @@ write_file (Elf *elf, int64_t size, int change_bo, size_t shnum) size = -1; } +#if HAVE_DECL_MMAP /* POSIX says that ftruncate and write may clear the S_ISUID and S_ISGID mode bits. So make sure we restore them afterwards if they were set. This is not atomic if someone else chmod's the file while we operate. */ @@ -156,6 +158,7 @@ write_file (Elf *elf, int64_t size, int change_bo, size_t shnum) __libelf_seterrno (ELF_E_WRITE_ERROR); size = -1; } +#endif if (size != -1 && elf->parent == NULL) elf->maximum_size = size; From patchwork Thu Oct 20 18:25:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 59223 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 C6198384BC3F for ; Thu, 20 Oct 2022 18:27:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C6198384BC3F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290423; bh=fofAaqthGNsW41BUX2rBUBspzBBZjA/gmwSYjl4/fjY=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=O4c30OFs/ceN0mvXsc3vdJjIiBLhr3UAk0NPj3ZRJqtsU4+wGdhKqGewQLDylyqSs qEcNt7uAP+UXQBtBsth2LnPPz0TVryl2yLEK0eqibDItjZMkOzCDxRIwLNFFs3Fqu+ GTLNZZpjMNu6sF16i1Za4e8SinieD3GT5YkNydPA= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by sourceware.org (Postfix) with ESMTPS id 6C0FD38654A2 for ; Thu, 20 Oct 2022 18:26:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6C0FD38654A2 Received: by mail-pl1-x629.google.com with SMTP id c24so110201plo.3 for ; Thu, 20 Oct 2022 11:26:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fofAaqthGNsW41BUX2rBUBspzBBZjA/gmwSYjl4/fjY=; b=OgvosIJeQidYnwQ8oUNYPZx/0D65nKV43Hq9ZSLm0shIjaCEGpAsy30473kfM+hPEQ 224QjNe1+kscuI6DXjQISSz+d3dukFiclk0EyqePZTTtC6kT2UB3phGw9vmNRnIIjRAI hR21RM+B3FuFG/LVe8MkmkTsDabju+y4O43nNLWB3j0rV5luctMQDRaQD6vULIpHlAoH CJoDxADESDdqGkEaa0sC5BcsNQQKZNSemmwujN+6Dnd1M1BovftcbT2UtpQz0nULj0xF +j81c71Rg7og7tXGH1zRnd0UHGzBVONU2ZJKOyIvzoNyH3AImMrK6q+mTwAGvbbfAv6e KC8w== X-Gm-Message-State: ACrzQf2PYgws4QtogoAZ7iRhlAWmMvVmcNvM+nybkcL/Vs40lFh7EH2J luZIYKEgxKHKDjndJKjTdpigYm3WgGLVaA== X-Google-Smtp-Source: AMsMyM4B8yPDEqaXoHptpngmCQjT+JtPJlMdHeMUXbwoqT1KuJAT14LN6o86CWuAtLa9bh8sCHVVfQ== X-Received: by 2002:a17:903:3249:b0:181:150c:fcc7 with SMTP id ji9-20020a170903324900b00181150cfcc7mr15710180plb.119.1666290399800; Thu, 20 Oct 2022 11:26:39 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.26.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:26:39 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 09/25] include libgen.h in system.h Date: Fri, 21 Oct 2022 02:25:48 +0800 Message-Id: <20221020182603.815-10-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yonggang Luo via Elfutils-devel From: Yonggang Luo Reply-To: Yonggang Luo Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" basename function are accessed multiple place, but used without include libgen.h Signed-off-by: Yonggang Luo --- lib/system.h | 1 + libdw/dwarf_getsrc_file.c | 2 +- libdwfl/dwfl_module_getsrc_file.c | 2 +- libdwfl/dwfl_segment_report_module.c | 2 +- libdwfl/find-debuginfo.c | 6 +++--- libdwfl/link_map.c | 2 +- src/addr2line.c | 4 ++-- src/nm.c | 4 ++-- src/stack.c | 2 +- src/strip.c | 2 +- 10 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/system.h b/lib/system.h index 561d3e03..7132cd6d 100644 --- a/lib/system.h +++ b/lib/system.h @@ -42,6 +42,7 @@ /* System dependend headers */ #include #include +#include #if HAVE_DECL_MMAP #include #endif diff --git a/libdw/dwarf_getsrc_file.c b/libdw/dwarf_getsrc_file.c index 5289c7da..884fea32 100644 --- a/libdw/dwarf_getsrc_file.c +++ b/libdw/dwarf_getsrc_file.c @@ -98,7 +98,7 @@ dwarf_getsrc_file (Dwarf *dbg, const char *fname, int lineno, int column, /* Match the name with the name the user provided. */ const char *fname2 = line->files->info[lastfile].name; if (is_basename) - lastmatch = strcmp (basename (fname2), fname) == 0; + lastmatch = strcmp (basename ((char *)fname2), fname) == 0; else lastmatch = strcmp (fname2, fname) == 0; } diff --git a/libdwfl/dwfl_module_getsrc_file.c b/libdwfl/dwfl_module_getsrc_file.c index cea2ba41..6daf29d6 100644 --- a/libdwfl/dwfl_module_getsrc_file.c +++ b/libdwfl/dwfl_module_getsrc_file.c @@ -103,7 +103,7 @@ dwfl_module_getsrc_file (Dwfl_Module *mod, { /* Match the name with the name the user provided. */ lastfile = file; - lastmatch = !strcmp (is_basename ? basename (file) : file, + lastmatch = !strcmp (is_basename ? basename ((char *)file) : file, fname); } } diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c index 287fc002..aa228254 100644 --- a/libdwfl/dwfl_segment_report_module.c +++ b/libdwfl/dwfl_segment_report_module.c @@ -736,7 +736,7 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name, bias += fixup; if (module->name[0] != '\0') { - name = basename (module->name); + name = basename ((char *)module->name); name_is_final = true; } break; diff --git a/libdwfl/find-debuginfo.c b/libdwfl/find-debuginfo.c index 7f7ab632..a9b7be3d 100644 --- a/libdwfl/find-debuginfo.c +++ b/libdwfl/find-debuginfo.c @@ -164,7 +164,7 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name, { bool cancheck = debuglink_crc != (GElf_Word) 0; - const char *file_basename = file_name == NULL ? NULL : basename (file_name); + const char *file_basename = file_name == NULL ? NULL : basename ((char *)file_name); char *localname = NULL; /* We invent a debuglink .debug name if NULL, but then want to try the @@ -278,7 +278,7 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name, else { subdir = NULL; - file = basename (debuglink_file); + file = basename ((char *)debuglink_file); } try_file_basename = debuglink_null; break; @@ -306,7 +306,7 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name, if (mod->dw != NULL && (p[0] == '\0' || p[0] == '/')) { fd = try_open (&main_stat, dir, ".dwz", - basename (file), &fname); + basename ((char *)file), &fname); if (fd < 0) { if (errno != ENOENT && errno != ENOTDIR) diff --git a/libdwfl/link_map.c b/libdwfl/link_map.c index 7ec7eca1..403d4ee5 100644 --- a/libdwfl/link_map.c +++ b/libdwfl/link_map.c @@ -469,7 +469,7 @@ report_r_debug (uint_fast8_t elfclass, uint_fast8_t elfdata, if (r_debug_info_module == NULL) { // XXX hook for sysroot - mod = __libdwfl_report_elf (dwfl, basename (name), + mod = __libdwfl_report_elf (dwfl, basename ((char *)name), name, fd, elf, base, true, true); if (mod != NULL) diff --git a/src/addr2line.c b/src/addr2line.c index 7768b266..3abf1d7a 100644 --- a/src/addr2line.c +++ b/src/addr2line.c @@ -381,7 +381,7 @@ print_dwarf_function (Dwfl_Module *mod, Dwarf_Addr addr) if (file == NULL) file = "???"; else if (only_basenames) - file = basename (file); + file = basename ((char *)file); else if (use_comp_dir && file[0] != '/') { const char *const *dirs; @@ -564,7 +564,7 @@ print_src (const char *src, int lineno, int linecol, Dwarf_Die *cu) const char *comp_dir_sep = ""; if (only_basenames) - src = basename (src); + src = basename ((char *)src); else if (use_comp_dir && src[0] != '/') { Dwarf_Attribute attr; diff --git a/src/nm.c b/src/nm.c index b46c1fd7..717ec0f6 100644 --- a/src/nm.c +++ b/src/nm.c @@ -1417,7 +1417,7 @@ show_symbols (int fd, Ebl *ebl, GElf_Ehdr *ehdr, int lineno; (void) dwarf_lineno (line, &lineno); const char *file = dwarf_linesrc (line, NULL, NULL); - file = (file != NULL) ? basename (file) : "???"; + file = (file != NULL) ? basename ((char *)file) : "???"; int n; n = obstack_printf (&whereob, "%s:%d%c", file, lineno, '\0'); @@ -1448,7 +1448,7 @@ show_symbols (int fd, Ebl *ebl, GElf_Ehdr *ehdr, { /* We found the line. */ int n = obstack_printf (&whereob, "%s:%" PRIu64 "%c", - basename ((*found)->file), + basename ((char *)(*found)->file), (*found)->lineno, '\0'); sym_mem[nentries_used].where = obstack_finish (&whereob); diff --git a/src/stack.c b/src/stack.c index 534aa93c..82413772 100644 --- a/src/stack.c +++ b/src/stack.c @@ -152,7 +152,7 @@ module_callback (Dwfl_Module *mod, void **userdata __attribute__((unused)), int width = get_addr_width (mod); printf ("0x%0*" PRIx64 "-0x%0*" PRIx64 " %s\n", - width, start, width, end, basename (name)); + width, start, width, end, basename ((char *)name)); const unsigned char *id; GElf_Addr id_vaddr; diff --git a/src/strip.c b/src/strip.c index 2a2cc801..6ac987fd 100644 --- a/src/strip.c +++ b/src/strip.c @@ -1800,7 +1800,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, elf_errmsg (-1)); } - char *debug_basename = basename (debug_fname_embed ?: debug_fname); + char *debug_basename = basename ((char *)(debug_fname_embed ?: debug_fname)); off_t crc_offset = strlen (debug_basename) + 1; /* Align to 4 byte boundary */ crc_offset = ((crc_offset - 1) & ~3) + 4; From patchwork Thu Oct 20 18:25:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 59227 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 650B4383EC5C for ; Thu, 20 Oct 2022 18:27:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 650B4383EC5C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290434; bh=SfZ1JLdeMlPTGpYrZl9/4ODxgDiVxf0aQ1iwJngEQxQ=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=fTGOHZyeRaQWfTCAhv5ygrQ67MKst7qhiyfMskR4Hwd0giC+7+z5CzHNacljY3P/s KJgaEvqLsJwD+1GnI4p56fyyBDhTmTD6CCTY8FTsZLfujEgrLKCKMwIvCXg8nBGKRF E21bGbu3/zSh+4n599zu+eE+ZUO/bVVMpeyLqKNg= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by sourceware.org (Postfix) with ESMTPS id 478F6384C00B for ; Thu, 20 Oct 2022 18:26:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 478F6384C00B Received: by mail-pl1-x636.google.com with SMTP id f23so97942plr.6 for ; Thu, 20 Oct 2022 11:26:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SfZ1JLdeMlPTGpYrZl9/4ODxgDiVxf0aQ1iwJngEQxQ=; b=1Oh1OpyBLZwNuGRFd/W4eUMaGXEeQNHCR7tLBlMwT6QC1XdqTPvGUiaIuE4mHYeVNJ gvaLD53nKTs6ErbK7sRE+c/lD54Fmf9OF87eZD792xxLQd5Sk5EkJfllyQvnm05Y8dp7 xur2JDYaM7vK9Yra1TSF06ImbCZF0zsdN7rFDq6ZADtFLHTP9Es8rfEq0UVRIXkLGxzO h2//S4FzmxuHDnHe2xHI5wyNcJaD6JWj6O90Zy/vjpnQ2o7qBfKHCiRxFEingjE9zU6j QG5eHV7FQjju/XelwQPprKEUOKl+0K+5visqmP7VaEMZytA6iF8jbawWGNMXvGbyrDm9 ALMQ== X-Gm-Message-State: ACrzQf118b4HPel05KAKU0MXk/Z8AWb6iO8o1VT9LNwWdzZ/ocoGBbkP +uNLMPBigy/BYcx0hF75dMq61U1W1MirLw== X-Google-Smtp-Source: AMsMyM7RlN/RBwhrDRaThz30HFQs52kbpnIoX0TldoZfLRuZhyHTaL0iu8hO2N2x22sqrU/zmYY/Dw== X-Received: by 2002:a17:90b:3b47:b0:20d:a991:3f24 with SMTP id ot7-20020a17090b3b4700b0020da9913f24mr43551779pjb.108.1666290402626; Thu, 20 Oct 2022 11:26:42 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.26.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:26:41 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 10/25] libcpu: Remove the need of NMNES by using enum Date: Fri, 21 Oct 2022 02:25:49 +0800 Message-Id: <20221020182603.815-11-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yonggang Luo via Elfutils-devel From: Yonggang Luo Reply-To: Yonggang Luo Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Signed-off-by: Yonggang Luo --- libcpu/Makefile.am | 2 +- libcpu/i386_parse.y | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/libcpu/Makefile.am b/libcpu/Makefile.am index 57d0a164..259ed838 100644 --- a/libcpu/Makefile.am +++ b/libcpu/Makefile.am @@ -92,7 +92,7 @@ libeu = ../lib/libeu.a i386_lex_CFLAGS = -Wno-unused-label -Wno-unused-function -Wno-sign-compare \ -Wno-implicit-fallthrough i386_parse.o: i386_parse.c i386.mnemonics -i386_parse_CFLAGS = -DNMNES="`wc -l < i386.mnemonics`" +i386_parse_CFLAGS = i386_lex.o: i386_parse.h i386_gendis_LDADD = $(libeu) -lm $(obstack_LIBS) diff --git a/libcpu/i386_parse.y b/libcpu/i386_parse.y index d2236d59..5f31484c 100644 --- a/libcpu/i386_parse.y +++ b/libcpu/i386_parse.y @@ -1108,9 +1108,14 @@ print_op_fct (const void *nodep, VISIT value, } -#if NMNES < 2 -# error "bogus NMNES value" -#endif +/* The index can be stored in the instrtab. */ +enum + { +#define MNE(name) MNE_##name, +#include "i386.mnemonics" +#undef MNE + MNE_COUNT + }; static void instrtable_out (void) @@ -1123,7 +1128,7 @@ instrtable_out (void) fprintf (outfile, "#define MNEMONIC_BITS %zu\n", best_mnemonic_bits); #else fprintf (outfile, "#define MNEMONIC_BITS %ld\n", - lrint (ceil (log2 (NMNES)))); + lrint (ceil (log2 (MNE_COUNT)))); #endif fprintf (outfile, "#define SUFFIX_BITS %d\n", nbitsuf); for (int i = 0; i < 3; ++i) From patchwork Thu Oct 20 18:25:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 59225 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 DE7C5384B0C9 for ; Thu, 20 Oct 2022 18:27:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DE7C5384B0C9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290431; bh=4jmJwUVCsODCvNPa2Reqfk1yvJJaV2ytewti/ko8TmQ=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=CA/W8JT51eaZ86IjOatxXvpW/je1AlR8+y3BQ1q8HSMD++k/iCzasne+T6PFV4FCv Lylpu7lCMHC9rkT3eMiJYIvCQrVSDYTU/RZ65fsfMFmnJ/4DB9p07NqtSm1QVNXhhg KttT79unB5LaMqsWJlgDtyUqPvD34fNklPajsDM4= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id E4B47384D156 for ; Thu, 20 Oct 2022 18:26:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E4B47384D156 Received: by mail-pl1-x62a.google.com with SMTP id j12so102135plj.5 for ; Thu, 20 Oct 2022 11:26:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4jmJwUVCsODCvNPa2Reqfk1yvJJaV2ytewti/ko8TmQ=; b=fbxCt2bxP7yrPTw47rUKPH8JIo/gTWWgyws14jt+7Az8gZpUNlP/5DSoUVWB0u+71g F9EV9KqBCYwMjWVNsXwRUZ1qgodxC2uShH8HaYHKTlflEfCVBYu2tNU0iYepwEnP9HWf 8wLOLRNhr6C/KRGzRrzRfQ57S3rVEkpYvvPzjFc3+8h/+VRfEn3pvavk/V1HWVZo9qnj Eeu2UnR++I3KqrTisqel69FccfELP38WCqmZlDWOfgp5eGJkPO2JWqVh4gEN0T0VM5yB R1HTEyfTNpioubHNQZCjFrUSFwOclhux8CCXl/LA3xI9j3vByernAYuIINYEYZYPO5j5 QybQ== X-Gm-Message-State: ACrzQf2vhnHsYrz/B4wkkDp5JaEGWl5tj3E4IaO4q818W2W6daOn2ryM RtYF0KAkMi7VtcpMeQ7QUyAOHWX/mK0+ZA== X-Google-Smtp-Source: AMsMyM4FNNwV6KfaimaHHZImT35SIe+tDVo/6FXHqfodKJ641re+Um+cVBl9J4ZSFG21LtWSZl2inQ== X-Received: by 2002:a17:902:e3cd:b0:17f:9c94:b22f with SMTP id r13-20020a170902e3cd00b0017f9c94b22fmr15211841ple.80.1666290405198; Thu, 20 Oct 2022 11:26:45 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.26.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:26:44 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 11/25] libcpu: Use __asm instead asm that can be recognized by both clang-cl and gcc Date: Fri, 21 Oct 2022 02:25:50 +0800 Message-Id: <20221020182603.815-12-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yonggang Luo via Elfutils-devel From: Yonggang Luo Reply-To: Yonggang Luo Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Signed-off-by: Yonggang Luo --- libcpu/i386_disasm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c index 599d1654..cc75a7b1 100644 --- a/libcpu/i386_disasm.c +++ b/libcpu/i386_disasm.c @@ -480,7 +480,7 @@ i386_disasm (Ebl *ebl __attribute__((unused)), /* gcc is not clever enough to see the following variables are not used uninitialized. */ - asm ("" + __asm ("" : "=mr" (opoff), "=mr" (correct_prefix), "=mr" (codep), "=mr" (next_curr), "=mr" (len)); } From patchwork Thu Oct 20 18:25:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 59222 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 F1162384BC3C for ; Thu, 20 Oct 2022 18:27:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F1162384BC3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290422; bh=OhQZOrLsCYaSA3FHumu+RfJnl9p6stSeO/QMKLz+Gpg=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=fuvuVPJaSAfGAWiXo27iapIy2T2nQUppTFUbSl7FyX9b7+wHoLkRAeqg/8D5vzUED Nzckx9EMJWMcp1P0CdBg5AyFWnyp/PkQ53YDedv375PFF4QRUoXgleLFvZD76JlD1x eqOhpSZQpZB9vPYw2/TwzQAaN81v/dOKabpwMqrk= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id 3AD74384B82B for ; Thu, 20 Oct 2022 18:26:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3AD74384B82B Received: by mail-pf1-x430.google.com with SMTP id y8so303349pfp.13 for ; Thu, 20 Oct 2022 11:26:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OhQZOrLsCYaSA3FHumu+RfJnl9p6stSeO/QMKLz+Gpg=; b=014yhgaSSf0oSr4SUnrd38yiQMMpMo2Aw9/0925A1ZbTU3k2fpT2ZcydOC0Qu4Rkg0 sioYusKgSdtSKjJrGKz3/aLFm9U1YMBRJhLsHvztiAR07FOlUZjbpwZYc98zVWo0aoUu +3bj7QwPHlGUKhh2y66we2tSHadINi+RtG5bH3GVicMqDU02/AQsrxuT0bKjiZxYK72a f2UHToS6qz2i7c4/weU+GqTCEzwXNj4cEEOLGYsfxCYeoEv0HpRKGOlHz54TGe6bDTMW 4vDc5qWvIA6ra8v88mnHAcUJh1mlNTPbIHpe0rhJ2ySaKVRSOXb7L8K7wOP69dR3T5iw yF4Q== X-Gm-Message-State: ACrzQf0eiTmSrK/e0GbLcIBJO2eEoJB3isUv/0zhY5F7V2PZAUrUh6kp zEnDsGGREBiYoitnjKvD+FuJeLM4BLF4ow== X-Google-Smtp-Source: AMsMyM4nYjHtOykmr2M00NYw1GlunmDnNMTqMQwQYN0sKrRbofk869o2psYqYFiZ2Q66mEAIfsPRVA== X-Received: by 2002:a63:4a41:0:b0:452:bab5:156a with SMTP id j1-20020a634a41000000b00452bab5156amr12900449pgl.486.1666290407702; Thu, 20 Oct 2022 11:26:47 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.26.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:26:46 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 12/25] libcpu: Use "#define FCT_mod$64r_m FCT_mod$r_m" is enough and can be recognized by clang-cl on windows in i386_data.h Date: Fri, 21 Oct 2022 02:25:51 +0800 Message-Id: <20221020182603.815-13-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yonggang Luo via Elfutils-devel From: Yonggang Luo Reply-To: Yonggang Luo Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Signed-off-by: Yonggang Luo --- libcpu/i386_data.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcpu/i386_data.h b/libcpu/i386_data.h index 06356b8a..fe3c4ae1 100644 --- a/libcpu/i386_data.h +++ b/libcpu/i386_data.h @@ -1153,7 +1153,7 @@ FCT_mod$64r_m (struct output_data *d) return general_mod$r_m (d); } #else -static typeof (FCT_mod$r_m) FCT_mod$64r_m __attribute__ ((alias ("FCT_mod$r_m"))); +#define FCT_mod$64r_m FCT_mod$r_m #endif From patchwork Thu Oct 20 18:25:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 59226 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 7E161384A078 for ; Thu, 20 Oct 2022 18:27:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7E161384A078 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290432; bh=AzKiTuwPPDTQy6GoFdXoOtnoSxNA70w3l4LAsQGNAyM=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=r5erQeDIj3F2FqqNrv1N+tOAiXiZPjB43/tsvO39hqkrpuyOMcdh3TFCnE7DPyY8F MuNEJTAtjTNkqiA4w3G5cYTM5rrmiPYAAWwCAbz6YLIfougBEcxtUQ7Nyp3Kz6IToB Ck8ksc8Rzx6zZQbobAJ1chpLzDZ/iLFoYAMZqlB8= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id 0A977384D177 for ; Thu, 20 Oct 2022 18:26:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0A977384D177 Received: by mail-pf1-x42d.google.com with SMTP id i3so323112pfk.9 for ; Thu, 20 Oct 2022 11:26:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AzKiTuwPPDTQy6GoFdXoOtnoSxNA70w3l4LAsQGNAyM=; b=N2om+OiioWPWZ0blXGOlI3Rxjqy8u7jRFCKmMEnlhvdzNBrbrcrE2fdSZpjEO8Gr1c vaGFdTOGdBZwqzYWiuGcpLxc57xYC9cB28f8Num2brwq36IiIcxgKncb60E3VMbnSgO2 mhw0eqexYkZT8NIndPrFPSWQw46kUVwvggUGz02twUAE67fEFHTqTZcfaJgRElxoeLnc DPopRULbBXVb6BaBjlxwYT/73m+GaLdoTgT5D2pHLINfvUIERlc52tH2M079SSWGa1XR roGEMbrkm1ubrh2plraM7rwTVUAIyb3ViwVxNkl/4MOvvoEiBka85UmynU4rAleyNQ+i GXeg== X-Gm-Message-State: ACrzQf1WfI9w8eIG6Q1ghIdR8+CHGNnAnwH5I/xhLfO55w0kQI5BcqBq JTdYR/39G56aAgx/SQBX0V53e+B1+SPQBQ== X-Google-Smtp-Source: AMsMyM7EDnzo3rG6mmqKhGe3voRyz+IeEqvSbTkeYglvjbBTHOOXphu9bZaEoJ6Va9L/IOB/I/k4+Q== X-Received: by 2002:a63:ed0a:0:b0:442:2514:95f5 with SMTP id d10-20020a63ed0a000000b00442251495f5mr13002509pgi.402.1666290410289; Thu, 20 Oct 2022 11:26:50 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.26.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:26:49 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 13/25] libdw: typeof -> __typeof that can be recognized by both clang-cl and gcc Date: Fri, 21 Oct 2022 02:25:52 +0800 Message-Id: <20221020182603.815-14-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yonggang Luo via Elfutils-devel From: Yonggang Luo Reply-To: Yonggang Luo Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Signed-off-by: Yonggang Luo --- libdw/memory-access.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libdw/memory-access.h b/libdw/memory-access.h index 16c8c851..fca4129a 100644 --- a/libdw/memory-access.h +++ b/libdw/memory-access.h @@ -64,7 +64,7 @@ __libdw_max_len_sleb128 (const unsigned char *addr, const unsigned char *end) #define get_uleb128_step(var, addr, nth) \ do { \ unsigned char __b = *(addr)++; \ - (var) |= (typeof (var)) (__b & 0x7f) << ((nth) * 7); \ + (var) |= (__typeof (var)) (__b & 0x7f) << ((nth) * 7); \ if (likely ((__b & 0x80) == 0)) \ return (var); \ } while (0) @@ -112,11 +112,11 @@ __libdw_get_uleb128_unchecked (const unsigned char **addrp) #define get_sleb128_step(var, addr, nth) \ do { \ unsigned char __b = *(addr)++; \ - (var) |= (typeof (var)) (__b & 0x7f) << ((nth) * 7); \ + (var) |= (__typeof (var)) (__b & 0x7f) << ((nth) * 7); \ if (likely ((__b & 0x80) == 0)) \ { \ if ((__b & 0x40) != 0) \ - (var) |= - ((typeof (var)) 1 << (((nth) + 1) * 7)); \ + (var) |= - ((__typeof (var)) 1 << (((nth) + 1) * 7)); \ return (var); \ } \ } while (0) @@ -146,7 +146,7 @@ __libdw_get_sleb128 (const unsigned char **addrp, const unsigned char *end) { /* We only need the low bit of the final byte, and as it is the sign bit, we don't need to do anything else here. */ - acc |= ((typeof (acc)) b) << 7 * max; + acc |= ((__typeof (acc)) b) << 7 * max; return acc; } @@ -179,7 +179,7 @@ __libdw_get_sleb128_unchecked (const unsigned char **addrp) { /* We only need the low bit of the final byte, and as it is the sign bit, we don't need to do anything else here. */ - acc |= ((typeof (acc)) b) << 7 * max; + acc |= ((__typeof (acc)) b) << 7 * max; return acc; } From patchwork Thu Oct 20 18:25:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 59228 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 451BF384B110 for ; Thu, 20 Oct 2022 18:27:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 451BF384B110 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290438; bh=Jxq7ttZDjKXncgNEE1Vrh/fNVRQ+k+jg/nND2lR5FTc=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=HaVLnsZjJPH75sxCzOApKFgxv8c6VEZm+/2HUIIO3QbLTCveCGdmPPlSj57auUEPR AMmNScDaLVkbTSoDcoy6vlxdpCcJmftyl95DiJjXwifoiyPnKJovAUuDsmwWQq/G/5 BmIF6/owtgHQXEtQC/LKGristBnRmm/WunTHSCSA= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by sourceware.org (Postfix) with ESMTPS id CF5FC384D15D for ; Thu, 20 Oct 2022 18:26:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CF5FC384D15D Received: by mail-pg1-x52f.google.com with SMTP id s196so308301pgs.3 for ; Thu, 20 Oct 2022 11:26:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Jxq7ttZDjKXncgNEE1Vrh/fNVRQ+k+jg/nND2lR5FTc=; b=vBv/sYVKsYfRRqeet3LiBtB2HlXIh3hAeXEm1Gx+yvXTsBQfCZRCVhBcPFnIDXCFL7 VPS8cvb6TtfP5TZb+hzjJ55HF5s2pa7hig4oGCIDj0UuP4wHT3f8AUd8oaXWZhRrVldB dkcWmrna9k/f+U5vytJAP8OlhVdL08FA8u/4IuOT3M1PqV0FS5NssgD/Nib8vnkm0y/2 sWTQGSpKsJ/ZqSsBEr6/qQu+ssx8SmenNMHozGT3EAMjrHL80O+jNXzzdV8Cqg1UqYcU 0NvjLg7+0/mQGPl6FiyewrSKuG+CwxnUTkAw3eDKI08GsUMVPuNbZ6c7+iCZ0LhLugHw rHhQ== X-Gm-Message-State: ACrzQf3ZmWhIlC3IzhsXGDdV7EW9CdT+5GmpZBMtghdCEkPcZ8fn5PHv dQyuIHhtPuVui91K64qFBv0++MF2qnMowQ== X-Google-Smtp-Source: AMsMyM5zQLYnJOCYfKtGkG5Tnr2DSWM7mM5jNvcqYFtdShP3P5SsRFjrbB8EukDirE5cCtPJGYtHBg== X-Received: by 2002:a65:6c08:0:b0:448:c216:fe9 with SMTP id y8-20020a656c08000000b00448c2160fe9mr12611812pgu.243.1666290413404; Thu, 20 Oct 2022 11:26:53 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.26.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:26:52 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 14/25] libdw: check __OPTIMIZE__ in dwarf_whatattr.c and dwarf_whatform.c to match the header Date: Fri, 21 Oct 2022 02:25:53 +0800 Message-Id: <20221020182603.815-15-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yonggang Luo via Elfutils-devel From: Yonggang Luo Reply-To: Yonggang Luo Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Signed-off-by: Yonggang Luo Signed-off-by: Yonggang Luo --- libdw/dwarf_whatattr.c | 3 ++- libdw/dwarf_whatform.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libdw/dwarf_whatattr.c b/libdw/dwarf_whatattr.c index d664b021..59769865 100644 --- a/libdw/dwarf_whatattr.c +++ b/libdw/dwarf_whatattr.c @@ -34,9 +34,10 @@ #include #include "libdwP.h" - +#ifndef __OPTIMIZE__ unsigned int dwarf_whatattr (Dwarf_Attribute *attr) { return attr == NULL ? 0 : attr->code; } +#endif diff --git a/libdw/dwarf_whatform.c b/libdw/dwarf_whatform.c index dee29a9f..01a33424 100644 --- a/libdw/dwarf_whatform.c +++ b/libdw/dwarf_whatform.c @@ -34,9 +34,10 @@ #include #include "libdwP.h" - +#ifndef __OPTIMIZE__ unsigned int dwarf_whatform (Dwarf_Attribute *attr) { return attr == NULL ? 0 : attr->form; } +#endif From patchwork Thu Oct 20 18:25:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 59232 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 BB3E4388302D for ; Thu, 20 Oct 2022 18:27:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BB3E4388302D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290448; bh=7fgEYu6qXaDPRDHYyYp7/B7V8pL4CCh3RRUc906CqbY=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=mxmuz96fsw+ITB2zmSlAD+X1PwGqAVLUlL3+WXmNNtw4kI+zUSzaV6PajZz8UTBGG WDqNq5jrhT9RHmeN5x3tLM1RAwIdNBzWNx7y4ZGkmaKSLrWNacaEFV1UBXEUpGvrXX rHq4SS+PkAsH6GEbzteQOyQw65OJ/QJ72vjzbNJ4= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by sourceware.org (Postfix) with ESMTPS id 2FE683865C28 for ; Thu, 20 Oct 2022 18:26:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2FE683865C28 Received: by mail-pj1-x1031.google.com with SMTP id o17-20020a17090aac1100b0020d98b0c0f4so4300495pjq.4 for ; Thu, 20 Oct 2022 11:26:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7fgEYu6qXaDPRDHYyYp7/B7V8pL4CCh3RRUc906CqbY=; b=ardnAewvAEqypcXXeoD9kvV0gxXQwj2ZNqjq0fg4gE43UxMkJqd6lqIRh4cQnJ6O0q FG0CY3kMPdMtuPgsV3a4UiSNXbAaksXgMT5IUuyx4CZBL7J9Z9kaqhHp/vicG2XB8lry 1tb/Cm73vKEaZ9UiQW785ZsqxMlZgCyPAmAoQ33wFLR1MdOohY5Tx7gdFFE63ZXRMlFf vYTXWXyXNNfp6x7+hpVZ+Iql+CrbMvw07sZaUWxsxmms/z6yreLpjukNLmipioFy01Lv RdQ1m3Em7dONI6dmpue/JaarwdAgtsseFM4zDg+c9P701DRN1ToBdqqzVB/I0ACLjt0A RMOw== X-Gm-Message-State: ACrzQf05ndGudOrxnbg+XyTnzZrs03XsYNAdawvXSBlZ9HrUMMByn6TV fErFdVbeRlUFoH2Xzxcs9MPkWwf05IzxyQ== X-Google-Smtp-Source: AMsMyM5j8NwBw2nr2bumwkIfgLfLGeaNVvXq74APS/TrQIgsy7+FWFk9YyDuBxbmxMNqXwk7eromlw== X-Received: by 2002:a17:903:2306:b0:185:43a2:3d1c with SMTP id d6-20020a170903230600b0018543a23d1cmr15336293plh.154.1666290415441; Thu, 20 Oct 2022 11:26:55 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.26.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:26:54 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 15/25] lib: Implement error properly even when not HAVE_ERR_H Date: Fri, 21 Oct 2022 02:25:54 +0800 Message-Id: <20221020182603.815-16-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yonggang Luo via Elfutils-devel From: Yonggang Luo Reply-To: Yonggang Luo Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" on win32, there is no err.h Signed-off-by: Yonggang Luo --- lib/error.c | 9 ++++++++- lib/system.h | 4 +--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/error.c b/lib/error.c index 5186fc15..7924735e 100644 --- a/lib/error.c +++ b/lib/error.c @@ -28,12 +28,14 @@ #include -#if !defined(HAVE_ERROR_H) && defined(HAVE_ERR_H) +#if !defined(HAVE_ERROR_H) #include #include #include #include +#if defined(HAVE_ERR_H) #include +#endif unsigned int error_message_count = 0; @@ -44,6 +46,7 @@ void error(int status, int errnum, const char *format, ...) { fflush (stdout); va_start(argp, format); +#if defined(HAVE_ERR_H) if (status) { if (errnum) @@ -64,6 +67,10 @@ void error(int status, int errnum, const char *format, ...) { else vwarnx (format, argp); } +#else + (void)status; + vfprintf(stderr, format, argp); +#endif va_end(argp); fflush (stderr); diff --git a/lib/system.h b/lib/system.h index 7132cd6d..264781c2 100644 --- a/lib/system.h +++ b/lib/system.h @@ -51,11 +51,9 @@ #if defined(HAVE_ERROR_H) #include -#elif defined(HAVE_ERR_H) +#else extern int error_message_count; void error(int status, int errnum, const char *format, ...); -#else -#error "err.h or error.h must be available" #endif /* error (EXIT_FAILURE, ...) should be noreturn but on some systems it From patchwork Thu Oct 20 18:25:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 59230 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 354BD383FB9F for ; Thu, 20 Oct 2022 18:27:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 354BD383FB9F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290443; bh=mKnW4kS3gT9rA1UAlTAosnFdYlqn4ovw3lG9e00/lk4=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=pMxtFCvEFEBXTSDF1SUVYIWLrrip+IwQTUg9Qsjy/wj1Mki3998w6zlldVQEtYMu3 /9bCjGeWGxYBOGcGReayqLRu+Lu7xMpdJuOxHQ+1F6h+a/sG9zeXf6x7Qdizw+wyWj PU0AYnF4bsb0iY51/vvh/qQ3G79pAjhUmMkx21vs= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by sourceware.org (Postfix) with ESMTPS id 03A1E384B835 for ; Thu, 20 Oct 2022 18:26:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 03A1E384B835 Received: by mail-pj1-x1035.google.com with SMTP id f9-20020a17090a654900b00210928389f8so4332954pjs.2 for ; Thu, 20 Oct 2022 11:26:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mKnW4kS3gT9rA1UAlTAosnFdYlqn4ovw3lG9e00/lk4=; b=XZ3r9S1Nxn6r2zJrLN/VJc3VId0rk6myb2vGFIOibKzjD7bkiECiGTusUM9iSFxxfY twXoqOYRbJoN9y6ZqHlpO0Gh2UcpBOZjWhvauIYP7hN0Y1qwJ+2B0wfI6fvQwuJFkg4W IxuIxTsP4GmZIeGZ5qKzhktHYDJAM13ccNk9WvdaKsPvVtabT3H9w0AbMzBuP7tCMSbn TCBxQkyoZMOtD89ztNMjPuqzoPjfx0qPoIGtI2MsBSYVK2SbpwmGppmla9nzLV52GzZu Z/5twyQVJ1oWm9gYfP8Ms7rlwc0Rh7v8JayBceLEuxRQPxJFuWnfjjRpzIorUE2T+RJp wgsQ== X-Gm-Message-State: ACrzQf2czvwSOF0LF1rW4LrWNPT0zjHDYm9/XaWE8uEv6JUaUCR+oG1G KFcSL5YKmuO4CmbmaY7X8LvbLVC4xqAkBA== X-Google-Smtp-Source: AMsMyM4rF3GPZVHR1QLveSZtPFHLRojQAeI2nULN7dk3ADohQ0xnaCMLtBDDJHCWTBzzjTVVd7UQaQ== X-Received: by 2002:a17:90b:180f:b0:20d:4e7f:5f52 with SMTP id lw15-20020a17090b180f00b0020d4e7f5f52mr54129138pjb.119.1666290417520; Thu, 20 Oct 2022 11:26:57 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.26.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:26:56 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 16/25] libeu: Move the implementation of pwrite_retry, write_retry and pread_retry from header to source Date: Fri, 21 Oct 2022 02:25:55 +0800 Message-Id: <20221020182603.815-17-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yonggang Luo via Elfutils-devel From: Yonggang Luo Reply-To: Yonggang Luo Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Signed-off-by: Yonggang Luo --- lib/Makefile.am | 2 +- lib/system.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++ lib/system.h | 59 ++++----------------------------- 3 files changed, 94 insertions(+), 54 deletions(-) create mode 100644 lib/system.c diff --git a/lib/Makefile.am b/lib/Makefile.am index 42ddf5ae..7a50085b 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -35,7 +35,7 @@ noinst_LIBRARIES = libeu.a libeu_a_SOURCES = xasprintf.c xstrdup.c xstrndup.c xmalloc.c next_prime.c \ crc32.c crc32_file.c \ - color.c error.c printversion.c + color.c error.c printversion.c system.c noinst_HEADERS = fixedsizehash.h libeu.h system.h dynamicsizehash.h list.h \ eu-config.h color.h printversion.h bpf.h \ diff --git a/lib/system.c b/lib/system.c new file mode 100644 index 00000000..0fd28968 --- /dev/null +++ b/lib/system.c @@ -0,0 +1,87 @@ +/* Definitions for system functions. + Copyright (C) 2006-2011 Red Hat, Inc. + Copyright (C) 2022 Mark J. Wielaard + Copyright (C) 2022 Yonggang Luo + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils 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 + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see . */ + +#include "system.h" + +ssize_t +pwrite_retry(int fd, const void *buf, size_t len, off_t off) +{ + ssize_t recvd = 0; + + do + { + ssize_t ret = TEMP_FAILURE_RETRY (pwrite (fd, ((char *)buf) + recvd, len - recvd, + off + recvd)); + if (ret <= 0) + return ret < 0 ? ret : recvd; + + recvd += ret; + } + while ((size_t) recvd < len); + + return recvd; +} + +ssize_t +write_retry(int fd, const void *buf, size_t len) +{ + ssize_t recvd = 0; + + do + { + ssize_t ret = TEMP_FAILURE_RETRY (write (fd, ((char *)buf) + recvd, len - recvd)); + if (ret <= 0) + return ret < 0 ? ret : recvd; + + recvd += ret; + } + while ((size_t) recvd < len); + + return recvd; +} + +ssize_t +pread_retry(int fd, void *buf, size_t len, off_t off) +{ + ssize_t recvd = 0; + + do + { + ssize_t ret = TEMP_FAILURE_RETRY (pread (fd, ((char *)buf) + recvd, len - recvd, + off + recvd)); + if (ret <= 0) + return ret < 0 ? ret : recvd; + + recvd += ret; + } + while ((size_t) recvd < len); + + return recvd; +} diff --git a/lib/system.h b/lib/system.h index 264781c2..05b2d8f9 100644 --- a/lib/system.h +++ b/lib/system.h @@ -145,61 +145,14 @@ startswith (const char *str, const char *prefix) #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666 */ #endif -static inline ssize_t __attribute__ ((unused)) -pwrite_retry (int fd, const void *buf, size_t len, off_t off) -{ - ssize_t recvd = 0; - - do - { - ssize_t ret = TEMP_FAILURE_RETRY (pwrite (fd, ((char *)buf) + recvd, len - recvd, - off + recvd)); - if (ret <= 0) - return ret < 0 ? ret : recvd; +ssize_t +pwrite_retry (int fd, const void *buf, size_t len, off_t off); - recvd += ret; - } - while ((size_t) recvd < len); - - return recvd; -} +ssize_t +write_retry (int fd, const void *buf, size_t len); -static inline ssize_t __attribute__ ((unused)) -write_retry (int fd, const void *buf, size_t len) -{ - ssize_t recvd = 0; - - do - { - ssize_t ret = TEMP_FAILURE_RETRY (write (fd, ((char *)buf) + recvd, len - recvd)); - if (ret <= 0) - return ret < 0 ? ret : recvd; - - recvd += ret; - } - while ((size_t) recvd < len); - - return recvd; -} - -static inline ssize_t __attribute__ ((unused)) -pread_retry (int fd, void *buf, size_t len, off_t off) -{ - ssize_t recvd = 0; - - do - { - ssize_t ret = TEMP_FAILURE_RETRY (pread (fd, ((char *)buf) + recvd, len - recvd, - off + recvd)); - if (ret <= 0) - return ret < 0 ? ret : recvd; - - recvd += ret; - } - while ((size_t) recvd < len); - - return recvd; -} +ssize_t +pread_retry (int fd, void *buf, size_t len, off_t off); /* The demangler from libstdc++. */ extern char *__cxa_demangle (const char *mangled_name, char *output_buffer, From patchwork Thu Oct 20 18:25:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 59236 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 3F2B1383DB8D for ; Thu, 20 Oct 2022 18:27:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3F2B1383DB8D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290459; bh=WkjdKgikM8lQqVvpoElm4Qa2mG6bPEzSvINd5U512O0=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=LJ5xbxrA9K02GvHy1gwbmEkM6OvevIPL0cgS+DmXUSIolAlOXp9jlCmpxi7KeTfIA 8fNlCLATiF7yIEh8k9OYYR+kmGGsnheUDBv/7zhOaiyeiKxoEAbki0WWzOy2+gPAiW Eo49euaJgMdJxUTcVh2nYkfYpUkuqvzbNAzApRr0= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id A862F384D154 for ; Thu, 20 Oct 2022 18:27:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A862F384D154 Received: by mail-pf1-x42d.google.com with SMTP id i3so323488pfk.9 for ; Thu, 20 Oct 2022 11:27:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WkjdKgikM8lQqVvpoElm4Qa2mG6bPEzSvINd5U512O0=; b=Hq1Z9tKTqKm3dq41s7wc06EXi7+rV53NFOQ6M2FP+ghqlyDOfPB7A1yY0QZSvTJ4OC no0iMeGIfebs42h5T/2aX7sgV5JfxDq7v+Db6rDmeor9s7m974V2PuE9Cvbrtzc3nguo xu9flvhgelhXbbUEBobpB0OU9uFNb08in05kG6dAGhmd+x4Zrf/ZV5hdpwR4EgE1n4GW a58yCeHjxzeiujwMfgjuI7Wb9jyHQ1EWAiO6MRzAvkMlOJ80DeZPoNrn6TQcs5RUlCGs AQ/GfqY4oVyuQ9yjNUvca61H5Pkk4CMmwE/A9t+Z7yXL7sjx3nZ2ddynS/EgOMoTLiU5 e8ZQ== X-Gm-Message-State: ACrzQf2ObWAAzjaS2Ncj4L/ZozuHJOY8/I4YqbnOkXgONSEEgE1lm10D DWVbfyzE04OrFs4obowiv1GFi3ocgmQ24g== X-Google-Smtp-Source: AMsMyM7t/l7qNy8lbha5WysU4vwfCx8y2DVJ+LBX4XjGVCLxarsc0t9AL4ERLd1/e8GIFWRBtGGT1w== X-Received: by 2002:a65:44c5:0:b0:439:4697:ead0 with SMTP id g5-20020a6544c5000000b004394697ead0mr12680087pgs.45.1666290419803; Thu, 20 Oct 2022 11:26:59 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.26.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:26:59 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 17/25] libelf: uid_t, gid_t and mode_t are not comes with msvcrt, so using long/unsigned long instead on win32 Date: Fri, 21 Oct 2022 02:25:56 +0800 Message-Id: <20221020182603.815-18-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yonggang Luo via Elfutils-devel From: Yonggang Luo Reply-To: Yonggang Luo Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Signed-off-by: Yonggang Luo --- libelf/libelf.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libelf/libelf.h b/libelf/libelf.h index a139e733..2fa3838b 100644 --- a/libelf/libelf.h +++ b/libelf/libelf.h @@ -195,9 +195,15 @@ typedef struct { char *ar_name; /* Name of archive member. */ time_t ar_date; /* File date. */ +#if defined(_WIN32) + long ar_uid; + long ar_gid; + unsigned long ar_mode; +#else uid_t ar_uid; /* User ID. */ gid_t ar_gid; /* Group ID. */ mode_t ar_mode; /* File mode. */ +#endif int64_t ar_size; /* File size. */ char *ar_rawname; /* Original name of archive member. */ } Elf_Arhdr; From patchwork Thu Oct 20 18:25:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 59229 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 65E433865486 for ; Thu, 20 Oct 2022 18:27:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 65E433865486 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290442; bh=ojn/+pmqFRX7B+bb4fOR9k/GKPxCgUnLphVeLloo544=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=GXUjdkNohcKqwTl4bnoUs9Dr43TUEFr73r3efks58OnaQX/iYbAomvVH0jliE3C7W PjNO1z7SIJHEYaJsewzqzhM/oZ39FAo3+I8sWbGLHRf83jKrI1NRbZD9PQHY2xG4Ye zYms7PUspyB6XVPqxg+zoJtSpUenqkXKrI2aDNUQ= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by sourceware.org (Postfix) with ESMTPS id 49414384B807 for ; Thu, 20 Oct 2022 18:27:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 49414384B807 Received: by mail-pg1-x52d.google.com with SMTP id e129so284427pgc.9 for ; Thu, 20 Oct 2022 11:27:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ojn/+pmqFRX7B+bb4fOR9k/GKPxCgUnLphVeLloo544=; b=ViRrdXczTKNur6lpuPpnQT/hgWH5EnWJUFjYL7MTGtG3VPBJLy4Uq4bVhhdpB3WNMd dr5RE5IzEO/hXcHskY6qK8Z918vr8h44vFBnniYCr8B3d/gfQwkWVPp1Ztx7dJFw9sCd HgwvXuSqVARCxCHgV8H1Um6HM2YkVOCouRBiMKdXvvv13M6FzBAA1E64QpurjOIy1I1O GAdpr9hRovTl4dBMlQ8nu1juVphg2atOjZW7TEHq7KUj5t/BZeRwicu3Xm5Vv/4DZbp3 iSLALfMmy+A1ytg+NRuRu+MplA4alJQ665KSjnz4L5Z4Xdo1gyztxRjqEKIiuOs9vKpb SfTg== X-Gm-Message-State: ACrzQf2h1NCvqcZFZpWYP4gNGAdglQHLhpHKKpOKKrYYMwT112ArFv7E gT46SOVnG+qJn8/IH3dFZ+dg3mBYH/CWwQ== X-Google-Smtp-Source: AMsMyM4m1xSubUfifOGQEntm/eGVR8FL9zx9/xWPMH+/73ngaeITRUE+KJBMhA/wHeWrJw5lLevDaw== X-Received: by 2002:a63:8141:0:b0:460:5be4:f6a9 with SMTP id t62-20020a638141000000b004605be4f6a9mr12695817pgd.368.1666290421958; Thu, 20 Oct 2022 11:27:01 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.27.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:27:01 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 18/25] lib: Use NOT_HAVE_LIBINTL to guard #include Date: Fri, 21 Oct 2022 02:25:57 +0800 Message-Id: <20221020182603.815-19-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yonggang Luo via Elfutils-devel From: Yonggang Luo Reply-To: Yonggang Luo Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Add NOT_HAVE_LIBINTL macro to disable internationalization, sometimes we have don't want access internationalization such as MSVC, so the macro NOT_HAVE_LIBINTL can help that. Signed-off-by: Yonggang Luo --- lib/eu-config.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/eu-config.h b/lib/eu-config.h index 78a5c4fe..5e6c3c72 100644 --- a/lib/eu-config.h +++ b/lib/eu-config.h @@ -52,10 +52,17 @@ # define rwlock_unlock(lock) ((void) (lock)) #endif /* USE_LOCKS */ +#if !defined(NOT_HAVE_LIBINTL) #include +#endif + /* gettext helper macros. */ #define N_(Str) Str +#if !defined(NOT_HAVE_LIBINTL) #define _(Str) dgettext ("elfutils", Str) +#else +#define _(Str) N_(Str) +#endif /* Compiler-specific definitions. */ #define strong_alias(name, aliasname) \ From patchwork Thu Oct 20 18:25:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 59234 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 BC8CF3839DF9 for ; Thu, 20 Oct 2022 18:27:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BC8CF3839DF9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290453; bh=pV5k9XjtNM91HPNi81oJ1S+WElUoK9vHeUZhFdZgpn4=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=YY+qEszUjKfmQlRVF9Yi7jCgJrdmicN6Jb2DQObSVvvm+ccne574BNuP3g1QrMfOg gopJTHSg+xOCD8727TCLznPBWUZlUP+KiNBld25niFPfvhwFF4bo3pk8cL36kw9MrD CwjgWAjksXLfWnaGC4SwIL/oUKESrkxDRbQ3PjU4= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by sourceware.org (Postfix) with ESMTPS id AE59D384D159 for ; Thu, 20 Oct 2022 18:27:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AE59D384D159 Received: by mail-pf1-x432.google.com with SMTP id i3so314457pfc.11 for ; Thu, 20 Oct 2022 11:27:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pV5k9XjtNM91HPNi81oJ1S+WElUoK9vHeUZhFdZgpn4=; b=A15g3syDXi4YMX0b2hf+QPMZ6+SJU50bin8iacaEVFRJE0qIkuA65N6VuarXHzTxxz pn5KrsIUYsHtMSz6PCWoY2q3uSZ3kBZe9s0k7QJsKqohVsMhFJDj2uW1RdZPobyUTkZQ JgjPs9KozMVR0mxVt8isLUVlzpq9935niaj70ZWf7lymVyracieFfrYqffAJSYSJPYY4 NBZ3IEsIPfy8OfGFmeLhH4O6w+hrgCmnZt4l8/V5h3t+f26Yj+r62VK+Ptls4sPjmvLt aW20jO05EArK/1fn4aupw6dclrO5Hsjk1lg3MbI9Kw5l3OFKB/ZBuYqFGJ/Ada7feQyb H22w== X-Gm-Message-State: ACrzQf0eReTJlF/4tJYQXSNPgEdA24xPC7x54Muh1AQPuTQybvQi+hP+ WWPWBjL+ZpInIlAfHY0qtZBzxptq1K4zPg== X-Google-Smtp-Source: AMsMyM4JZwtLiC2iOfG+zfj+RxT5fVqZAuU7xp1TlRNR03aA7YQv1/bTeAj70HleeGBv/wFEZtqnEQ== X-Received: by 2002:a65:6d89:0:b0:421:94bc:cb89 with SMTP id bc9-20020a656d89000000b0042194bccb89mr12770264pgb.129.1666290423979; Thu, 20 Oct 2022 11:27:03 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.27.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:27:03 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 19/25] libelf: F_GETFD may not predefined with msvc/mingw, guard the usage of it Date: Fri, 21 Oct 2022 02:25:58 +0800 Message-Id: <20221020182603.815-20-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yonggang Luo via Elfutils-devel From: Yonggang Luo Reply-To: Yonggang Luo Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Signed-off-by: Yonggang Luo --- libelf/elf_begin.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c index 6d31882e..d867cd6f 100644 --- a/libelf/elf_begin.c +++ b/libelf/elf_begin.c @@ -1163,12 +1163,14 @@ elf_begin (int fildes, Elf_Cmd cmd, Elf *ref) if (ref != NULL) /* Make sure the descriptor is not suddenly going away. */ rwlock_rdlock (ref->lock); +#if defined(F_GETFD) else if (unlikely (fcntl (fildes, F_GETFD) == -1 && errno == EBADF)) { /* We cannot do anything productive without a file descriptor. */ __libelf_seterrno (ELF_E_INVALID_FILE); return NULL; } +#endif switch (cmd) { From patchwork Thu Oct 20 18:25:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 59233 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 29D64382DB21 for ; Thu, 20 Oct 2022 18:27:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 29D64382DB21 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290453; bh=iOj30/CcOtAMM0xID/reawrlwjNRU0Sz4fNvyAQNhf4=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=Sz6SJH0u/Wc1IQnbFGnG7xQJGmstadVignrYDyV3w8auvxaNy6zAHoj7tbR8sf429 NjHN9Heyn3pSbNprCIF0mFe+lzh3+3+0fd819+JXHYul/ribjg4T0gJ3KCYCKBsccy fjrcBKVrS1Sp8qIjQvyNeu2QOEfKIFKIq2zkc7qo= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by sourceware.org (Postfix) with ESMTPS id B6CC5384B122 for ; Thu, 20 Oct 2022 18:27:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B6CC5384B122 Received: by mail-pf1-x433.google.com with SMTP id d10so338815pfh.6 for ; Thu, 20 Oct 2022 11:27:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iOj30/CcOtAMM0xID/reawrlwjNRU0Sz4fNvyAQNhf4=; b=yexEKcqj6OvVkWaoSPOe4gqgdeAKJPuq/RQRYZTmvYeVN7RTfARy6xT4CYBGU/yPo7 naE190+ICnIqIHirc3aHIbrxtXu4AqtN2rUq1+pVQl1A8aHb3360rCPobl1qzflkYEwf P1RvPBwci38QznjG7QUbg0aBtXSPMij00EdaKbKlAWvgtGhn0WQjZ87i0HtCi0t3iqJS elmr8aHnqVN0dHh2svPutisE5O701M7m37ucIGgRyuLIHiJ/u4f/FdggjKPoTMetPrcj dr92HqKHeNZ8tlZk3sJonBrHnRofCqF7UQW5/1KAlBg9xHldONdWkNDiCdquh9pPgfOC jTIA== X-Gm-Message-State: ACrzQf3LVZGw/caJcObrLWA8yiPrgODJ/4wScRLmJFitkLxgt9IxhKP6 fjt02vI5jY5JfogFBt2iT/70YytijZXmlQ== X-Google-Smtp-Source: AMsMyM7/2lcLxsHeNSPJYIPnx4LJeIod15Joxjne9Z4DByTrXHY5fqRUX386QlR/eTha0sAbAQIlNw== X-Received: by 2002:a63:5d64:0:b0:446:983:b21d with SMTP id o36-20020a635d64000000b004460983b21dmr12818717pgm.441.1666290426221; Thu, 20 Oct 2022 11:27:06 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.27.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:27:05 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 20/25] Add function sys_get_page_size to replace platform dependent sysconf (_SC_PAGESIZE) Date: Fri, 21 Oct 2022 02:25:59 +0800 Message-Id: <20221020182603.815-21-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yonggang Luo via Elfutils-devel From: Yonggang Luo Reply-To: Yonggang Luo Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Signed-off-by: Yonggang Luo --- lib/crc32_file.c | 2 +- lib/system.c | 17 +++++++++++++++++ lib/system.h | 3 +++ libdw/dwarf_begin_elf.c | 2 +- libdwelf/dwelf_strtab.c | 2 +- libdwfl/linux-kernel-modules.c | 2 +- libdwfl/linux-proc-maps.c | 2 +- libelf/elf32_updatefile.c | 2 +- src/ar.c | 2 +- src/ranlib.c | 2 +- src/strings.c | 2 +- 11 files changed, 29 insertions(+), 9 deletions(-) diff --git a/lib/crc32_file.c b/lib/crc32_file.c index 66833702..45e1cc52 100644 --- a/lib/crc32_file.c +++ b/lib/crc32_file.c @@ -52,7 +52,7 @@ crc32_file (int fd, uint32_t *resp) void *mapped = mmap (NULL, mapsize, PROT_READ, MAP_PRIVATE, fd, 0); if (mapped == MAP_FAILED && errno == ENOMEM) { - const size_t pagesize = sysconf (_SC_PAGESIZE); + const size_t pagesize = sys_get_page_size(); mapsize = ((mapsize / 2) + pagesize - 1) & -pagesize; while (mapsize >= pagesize && (mapped = mmap (NULL, mapsize, PROT_READ, MAP_PRIVATE, diff --git a/lib/system.c b/lib/system.c index 0fd28968..9ce1b62e 100644 --- a/lib/system.c +++ b/lib/system.c @@ -28,7 +28,12 @@ the GNU Lesser General Public License along with this program. If not, see . */ +#include + #include "system.h" +#if defined(_WIN32) +#include +#endif ssize_t pwrite_retry(int fd, const void *buf, size_t len, off_t off) @@ -85,3 +90,15 @@ pread_retry(int fd, void *buf, size_t len, off_t off) return recvd; } + +size_t +sys_get_page_size(void) +{ +#ifdef _WIN32 + SYSTEM_INFO info; + GetSystemInfo(&info); + return info.dwPageSize; +#else + return sysconf (_SC_PAGESIZE); +#endif +} diff --git a/lib/system.h b/lib/system.h index 05b2d8f9..675ed221 100644 --- a/lib/system.h +++ b/lib/system.h @@ -154,6 +154,9 @@ write_retry (int fd, const void *buf, size_t len); ssize_t pread_retry (int fd, void *buf, size_t len, off_t off); +size_t +sys_get_page_size(void); + /* The demangler from libstdc++. */ extern char *__cxa_demangle (const char *mangled_name, char *output_buffer, size_t *length, int *status); diff --git a/libdw/dwarf_begin_elf.c b/libdw/dwarf_begin_elf.c index 8fcef335..0f13e2f5 100644 --- a/libdw/dwarf_begin_elf.c +++ b/libdw/dwarf_begin_elf.c @@ -502,7 +502,7 @@ dwarf_begin_elf (Elf *elf, Dwarf_Cmd cmd, Elf_Scn *scngrp) /* Default memory allocation size. */ - size_t mem_default_size = sysconf (_SC_PAGESIZE) - 4 * sizeof (void *); + size_t mem_default_size = sys_get_page_size() - 4 * sizeof (void *); assert (sizeof (struct Dwarf) < mem_default_size); /* Allocate the data structure. */ diff --git a/libdwelf/dwelf_strtab.c b/libdwelf/dwelf_strtab.c index c95f9467..293b2d93 100644 --- a/libdwelf/dwelf_strtab.c +++ b/libdwelf/dwelf_strtab.c @@ -86,7 +86,7 @@ dwelf_strtab_init (bool nullstr) { if (ps == 0) { - ps = sysconf (_SC_PAGESIZE); + ps = sys_get_page_size(); assert (sizeof (struct memoryblock) < ps - MALLOC_OVERHEAD); } diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c index 58c0c417..65a58616 100644 --- a/libdwfl/linux-kernel-modules.c +++ b/libdwfl/linux-kernel-modules.c @@ -550,7 +550,7 @@ intuit_kernel_bounds (Dwarf_Addr *start, Dwarf_Addr *end, Dwarf_Addr *notes) *notes = *end; } - Dwarf_Addr round_kernel = sysconf (_SC_PAGESIZE); + Dwarf_Addr round_kernel = sys_get_page_size(); *start &= -(Dwarf_Addr) round_kernel; *end += round_kernel - 1; *end &= -(Dwarf_Addr) round_kernel; diff --git a/libdwfl/linux-proc-maps.c b/libdwfl/linux-proc-maps.c index 719cba68..40b8050b 100644 --- a/libdwfl/linux-proc-maps.c +++ b/libdwfl/linux-proc-maps.c @@ -422,7 +422,7 @@ dwfl_linux_proc_find_elf (Dwfl_Module *mod __attribute__ ((unused)), if (fd < 0) goto detach; - *elfp = elf_from_remote_memory (base, sysconf (_SC_PAGESIZE), NULL, + *elfp = elf_from_remote_memory (base, sys_get_page_size(), NULL, &read_proc_memory, &fd); close (fd); diff --git a/libelf/elf32_updatefile.c b/libelf/elf32_updatefile.c index 8229fd26..af4518b8 100644 --- a/libelf/elf32_updatefile.c +++ b/libelf/elf32_updatefile.c @@ -474,7 +474,7 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum) /* Make sure the content hits the disk. */ char *msync_start = ((char *) elf->map_address - + (elf->start_offset & ~(sysconf (_SC_PAGESIZE) - 1))); + + (elf->start_offset & ~(sys_get_page_size() - 1))); char *msync_end = ((char *) elf->map_address + elf->start_offset + ehdr->e_shoff + ehdr->e_shentsize * shnum); diff --git a/src/ar.c b/src/ar.c index 3bcb18fe..d01f8482 100644 --- a/src/ar.c +++ b/src/ar.c @@ -428,7 +428,7 @@ copy_content (Elf *elf, int newfd, off_t off, size_t n) assert (off + n <= len); /* Tell the kernel we will read all the pages sequentially. */ - size_t ps = sysconf (_SC_PAGESIZE); + size_t ps = sys_get_page_size(); if (n > 2 * ps) posix_madvise (rawfile + (off & ~(ps - 1)), n, POSIX_MADV_SEQUENTIAL); diff --git a/src/ranlib.c b/src/ranlib.c index 7838d69e..645b40ae 100644 --- a/src/ranlib.c +++ b/src/ranlib.c @@ -122,7 +122,7 @@ copy_content (Elf *elf, int newfd, off_t off, size_t n) assert (off + n <= len); /* Tell the kernel we will read all the pages sequentially. */ - size_t ps = sysconf (_SC_PAGESIZE); + size_t ps = sys_get_page_size(); if (n > 2 * ps) posix_madvise (rawfile + (off & ~(ps - 1)), n, POSIX_MADV_SEQUENTIAL); diff --git a/src/strings.c b/src/strings.c index 55b047be..3341760d 100644 --- a/src/strings.c +++ b/src/strings.c @@ -163,7 +163,7 @@ main (int argc, char *argv[]) elf_version (EV_CURRENT); /* Determine the page size. We will likely need it a couple of times. */ - ps = sysconf (_SC_PAGESIZE); + ps = sys_get_page_size(); struct stat st; int result = 0; From patchwork Thu Oct 20 18:26:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 59237 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 3EBD7384D16E for ; Thu, 20 Oct 2022 18:27:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3EBD7384D16E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290464; bh=LxcUJrqPhIRKreAVjYiV0vCLRQcD3MwyLeIdeKOgafg=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=xpceOzCMJUwGAriP0a7vagbi30xtcxJCC3EOqzP17Jpl5XJuOwKItD5Ep26Bn8X2A hsozAZ1TKDMkNugCmC3HqRH3DB3kgEs7A1pYAGRk/5pozxpRriGlQXMubX99nWH5Jy 8wuUuQ67vMZnp8vjw94j/B0ddHfl5hKEbqp0ut2E= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id 9932C384B0C6 for ; Thu, 20 Oct 2022 18:27:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9932C384B0C6 Received: by mail-pf1-x42e.google.com with SMTP id p14so345077pfq.5 for ; Thu, 20 Oct 2022 11:27:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LxcUJrqPhIRKreAVjYiV0vCLRQcD3MwyLeIdeKOgafg=; b=j0Luwi4Iax7H5RNaM8JDVVmHbT6/sSKBZZ9uStl9VJERE1RweHqIE343vMCDRC6rrW +uqiA6KoOvhClX7+OahSLfkdcXik8a0AMalBTV749iIotQl0c9VIt+hwoT5TKPccx+9u 8XV5ZXg+at9gLT8aAj36OUi2JHvy84oTrz4T9uceh0KR6tO1oMEjT0DVuy8TpTvUw5lB 2JBnOUd8jF27Wcz6J1T9IuD+/+2A8pjmR8UxkrpW8BpqJVgpn8ara/c28LIWoJtkZaIf H3EqRmfnqAUT/hYYUJ45aEw4I2nTUbp4DYyKVrO04pWW5wOtFPRY69kRAklUwZ2mWQO8 +KnQ== X-Gm-Message-State: ACrzQf1kDfH7fSeGxp3Urz3t6LF2j13iJ26NKm5aPrxizfQ6MwCWPnHO wUxB72mIXbC7jEcDLVAsjhLsUYRDEd1bSQ== X-Google-Smtp-Source: AMsMyM5FqqBRojmUUztjvTdABL1k0pRSoa/G5FzZew9LksWVlHHjXGIqRi9wBPKhfCF1EsU3xaeiLw== X-Received: by 2002:a63:4d5:0:b0:460:9a0:b3a2 with SMTP id 204-20020a6304d5000000b0046009a0b3a2mr12966745pge.38.1666290428411; Thu, 20 Oct 2022 11:27:08 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.27.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:27:07 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 21/25] libasm: stdio_ext.h are not present on win32 Date: Fri, 21 Oct 2022 02:26:00 +0800 Message-Id: <20221020182603.815-22-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yonggang Luo via Elfutils-devel From: Yonggang Luo Reply-To: Yonggang Luo Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Signed-off-by: Yonggang Luo --- libasm/asm_begin.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libasm/asm_begin.c b/libasm/asm_begin.c index 9e4dfe43..9b6d974e 100644 --- a/libasm/asm_begin.c +++ b/libasm/asm_begin.c @@ -34,10 +34,13 @@ #include #include #include -#include #include #include +#if !defined(_WIN32) +#include +#endif + #include #include "libasmP.h" @@ -56,8 +59,10 @@ prepare_text_output (AsmCtx_t *result) free (result); result = NULL; } +#if !defined(_WIN32) else __fsetlocking (result->out.file, FSETLOCKING_BYCALLER); +#endif } return result; From patchwork Thu Oct 20 18:26:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 59231 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 4A7103839DFA for ; Thu, 20 Oct 2022 18:27:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4A7103839DFA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290445; bh=ibL7++OQoM7EyE+9/5O+zpaNaDuYIfoMk/NzQWLSBuw=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=Bp9bkHP8WmxvLQZMaOv+t9pjXYv9brRg4G6CbnUiClvm8QGQJe5CT2B1GcbMSkd2z dj8DL5c4JXjQnzxlxZMJyOOPVN5b5iHxBaiqkzrnIlEky2WilershQ9BUslXxlHAbx vWm0Ubm0RamXMMNnyidsrrbVgm60x0vrxkbs73U8= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id A576C383FB9A for ; Thu, 20 Oct 2022 18:27:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A576C383FB9A Received: by mail-pf1-x436.google.com with SMTP id 67so307515pfz.12 for ; Thu, 20 Oct 2022 11:27:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ibL7++OQoM7EyE+9/5O+zpaNaDuYIfoMk/NzQWLSBuw=; b=26S1QxCxijhzd4c1FDqYX0Hzk1/GYlImQXOVsof6BgsiLwIsA2uQtQrBfRQ4WZvoqd Ijo4XcGwZeqEwoH2UBEcrvkJlEhv2lCexnLV0iBNBya7H/PiAYmWLbUp0vyQZMeOqAES MuQZP1A3MBuUbtK/BRQ7xSSgJCaAsWRnBii4pEcUcfcRzGvmwo4pLTIQbDXWxAlxI+si 5PpDgJabMQy8P2Wm+kiUiPra0pEw4XKt02gDGk8YHI5GAUNJcFtYyjI++JcU8uQQ2hdZ /vWHfaNt15zf5a/Nh7akRyC/riDRqsdb8CcDexQZUBJACaka9oh8x7O7AfJ5bzWB1AMj Q2Ag== X-Gm-Message-State: ACrzQf13xsl01WmFy8I0eDRWWlrYp2uKfUWhL6LMMiaj4JTUz/3vQvze OYpHlm8adtvP/WqOEynrmC6oRAWsinH3fA== X-Google-Smtp-Source: AMsMyM79L4EM/IXtYy/ZTikUS7tCxhrm4qjqoRyrE1WnAzJqVG+9XCWax7C/rEiUwQSJ5peAzoaXHA== X-Received: by 2002:a63:5a46:0:b0:434:e36b:438f with SMTP id k6-20020a635a46000000b00434e36b438fmr12743374pgm.351.1666290430403; Thu, 20 Oct 2022 11:27:10 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.27.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:27:09 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 22/25] libebl/libdwelf: define ssize_t and pid_t for MSVC within installed header libdwelf.h and libebl.h Date: Fri, 21 Oct 2022 02:26:01 +0800 Message-Id: <20221020182603.815-23-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yonggang Luo via Elfutils-devel From: Yonggang Luo Reply-To: Yonggang Luo Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Signed-off-by: Yonggang Luo --- libdwelf/libdwelf.h | 5 +++++ libebl/libebl.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/libdwelf/libdwelf.h b/libdwelf/libdwelf.h index 263ca60e..167ac0dc 100644 --- a/libdwelf/libdwelf.h +++ b/libdwelf/libdwelf.h @@ -31,6 +31,11 @@ #include "libdw.h" +#ifdef _MSC_VER +#include +typedef SSIZE_T ssize_t; +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/libebl/libebl.h b/libebl/libebl.h index 731001d3..c568f623 100644 --- a/libebl/libebl.h +++ b/libebl/libebl.h @@ -44,6 +44,11 @@ #include "elf-knowledge.h" +#ifdef _MSC_VER +#include +typedef SSIZE_T ssize_t; +typedef int pid_t; +#endif /* Opaque type for the handle. libasm.h defined the same thing. */ #ifndef _LIBASM_H From patchwork Thu Oct 20 18:26:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 59235 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 B9526383FBBD for ; Thu, 20 Oct 2022 18:27:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B9526383FBBD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290455; bh=mIdr76GQnVv1kPXeEqpGA2avdLxHyd8TIFB6X5Np+AI=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=mg1hGNALIm8MDalYJia6aO2/wV/q4laplUANe321N0LBHlA8Y6JBX0UrSEUQp/ONr 5kCSVYkVYAdWbmocd6DUgCTGtieuD7pEmlzmEb+3d9g/U4FitpS0m8TJHFW/ThZ+3i Nsv9X6j8PzkivGSJLm08qn4rhG197fGXIp+np7Os= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by sourceware.org (Postfix) with ESMTPS id A4441384B127 for ; Thu, 20 Oct 2022 18:27:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A4441384B127 Received: by mail-pj1-x1035.google.com with SMTP id pb15so189107pjb.5 for ; Thu, 20 Oct 2022 11:27:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mIdr76GQnVv1kPXeEqpGA2avdLxHyd8TIFB6X5Np+AI=; b=fDEJN9L3a1Izw/ccg010HAkOjpBjWiMNET5IaVGZnpZ0qL6h1RY1G8WdiI93PYLiqt UzCWvfw4theowVoDLFVJbbOuBk/uCjVVBlaWcVcDmx9OxVm57YzCOF9qR/QjBpttnIqG QWWyVvlTUrLDYVz5EdYT8rPLNKO2Cr6jexqfBkCYLHy33v0NKDMJy4v3qb7jZ1b7eo0W TitYdGTwA1Xn0HANzAp34EqemhdqLVZN19vUS6y8NovSThco9nG8rwEOyeXCn6kqqX29 MS2fM3EgTiFonrPuPpxY5WPnpc5bpfLRiaoQAcvyU5Zc0flLIw54FUoJTneohBaL8Wbn V18A== X-Gm-Message-State: ACrzQf3AUPGsa4bgBhFh7fCQKwfX8+yMV4ZNbXyUM+x9mZRUTM5Im9Jx oQ+BZY7Fk41de373gymBZLel7wi4ns0XFg== X-Google-Smtp-Source: AMsMyM7JDD1smTmiPpYWwStwAeVpGeudoUlaWb+/cd8mR/FZQgQMqxwu9aOd7kMfxbMtXPwOIZ4MtA== X-Received: by 2002:a17:90b:4b0f:b0:211:41f:1c72 with SMTP id lx15-20020a17090b4b0f00b00211041f1c72mr7665997pjb.25.1666290432358; Thu, 20 Oct 2022 11:27:12 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.27.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:27:11 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 23/25] libasm/debuginfod: fchmod doesn't present on win32 Date: Fri, 21 Oct 2022 02:26:02 +0800 Message-Id: <20221020182603.815-24-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yonggang Luo via Elfutils-devel From: Yonggang Luo Reply-To: Yonggang Luo Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Signed-off-by: Yonggang Luo --- debuginfod/debuginfod-client.c | 4 +++- libasm/asm_end.c | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c index 2a14d9d9..4b7f837b 100644 --- a/debuginfod/debuginfod-client.c +++ b/debuginfod/debuginfod-client.c @@ -1405,9 +1405,11 @@ debuginfod_query_server (debuginfod_client *c, tvs[0].tv_usec = tvs[1].tv_usec = 0; (void) futimes (fd, tvs); /* best effort */ +#if !defined(_WIN32) /* PR27571: make cache files casually unwriteable; dirs are already 0700 */ (void) fchmod(fd, 0400); - +#endif + /* rename tmp->real */ rc = rename (target_cache_tmppath, target_cache_path); if (rc < 0) diff --git a/libasm/asm_end.c b/libasm/asm_end.c index c06d2366..54540bc1 100644 --- a/libasm/asm_end.c +++ b/libasm/asm_end.c @@ -512,12 +512,14 @@ asm_end (AsmCtx_t *ctx) if (result != 0) return result; +#if !defined(_WIN32) /* Make the new file globally readable and user/group-writable. */ if (fchmod (ctx->fd, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH) != 0) { __libasm_seterrno (ASM_E_CANNOT_CHMOD); return -1; } +#endif /* Rename output file. */ if (rename (ctx->tmp_fname, ctx->fname) != 0) From patchwork Thu Oct 20 18:26:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 59238 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 E43CA384D176 for ; Thu, 20 Oct 2022 18:27:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E43CA384D176 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290474; bh=66jzVvq3ZN+7lbp8CwAHNGRtXnz45vh1DN2S11XRPdU=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=G116YezpOUHtdheSNtEhE4smYHCV7EqE7p2WTtSVL81G/HT7SFh9r7g9Lz/Q4KQtw 7Gyqc6QNsD7FUBJFZ3iajrKveNf/hizM7TqtOGTE40Au5L0YulLDG0+AJQZEKjTHDW UR+0rOb2eyRt/C/w+K4UZUpY++CbD2u+Y4SJrByU= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by sourceware.org (Postfix) with ESMTPS id E3E9F383FBAA for ; Thu, 20 Oct 2022 18:27:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E3E9F383FBAA Received: by mail-pg1-x536.google.com with SMTP id q1so275574pgl.11 for ; Thu, 20 Oct 2022 11:27:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=66jzVvq3ZN+7lbp8CwAHNGRtXnz45vh1DN2S11XRPdU=; b=YUfXSEL78B1YOYTz+6d6JRa37zZN9+0/txmRNZxVb/YFJxoonReMaEc9Mavw18C9go ALdbjEdcjnB5nPaEo3hfu/NkmQ8D1NH4aan8DnyYXeU5f9yZBQkT35f4QZs5TSmdlTGm 5/4j03VDf+s2gJMgLGHOIwLu42MX/SLe5+f8Srzks6pMVyBHyvOXXb+tagoDM01d3D3e pggOqLZ0G3tfFSfrvxn/G51nEJbqsXL9GBNCd2kkH+TdaaV8OWGH48xIpEZ9qUuKEeNP NPEIZ+wZBW2WJIXrVUevDxU3Rzn1uHc8/vqdloAQhhsgW02LSq+2Prx02te5WqGFeTZ3 bZMw== X-Gm-Message-State: ACrzQf196R0JDV23a9LFn5e3eDP5LpnGVItkFhQFQtvHGAdX+hU0DbCl ye5jtTfv1iAA2coDjumkthPqpYLZgY2Zag== X-Google-Smtp-Source: AMsMyM7Pjv1hxk4gH/UdF+WS5XxTmC8Dqmm5SBlhOjgXRu8wyadiFKRC9IaXFovH5EbztWXpvqV9tg== X-Received: by 2002:a05:6a00:b85:b0:563:4623:ec40 with SMTP id g5-20020a056a000b8500b005634623ec40mr15164423pfj.56.1666290434506; Thu, 20 Oct 2022 11:27:14 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.27.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:27:13 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 24/25] lib: isatty is not available on windows Date: Fri, 21 Oct 2022 02:26:03 +0800 Message-Id: <20221020182603.815-25-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yonggang Luo via Elfutils-devel From: Yonggang Luo Reply-To: Yonggang Luo Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Signed-off-by: Yonggang Luo --- lib/color.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/color.c b/lib/color.c index 8063dc26..963a2ec2 100644 --- a/lib/color.c +++ b/lib/color.c @@ -117,9 +117,14 @@ parse_opt (int key, char *arg, if (strcmp (arg, values[i].str) == 0) { color_mode = values[i].mode; +#ifdef _WIN32 + if (color_mode == color_auto) + color_mode = color_never; +#else if (color_mode == color_auto) color_mode = isatty (STDOUT_FILENO) ? color_always : color_never; +#endif break; } if (i == nvalues)