From patchwork Tue Sep 20 08:43: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: 57790 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 94E5C3858023 for ; Tue, 20 Sep 2022 08:43:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 94E5C3858023 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663663416; bh=TAUi3JpiLo/oOT/DSCXa3yaG3BTp50+WO0uBrce82A8=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=CaH7nz93LAsooUklPufamGNkKdjONnaa7HY4srMiHCgdzIdUCTBmJBBetiYmueUz2 DZ4NzaXZw9nsWEhlMd91ue2DVhRhs0EzN8GrF5YGCDM7DYanRGYWy23GY2174YoALf JMu6lDA5xHUeYyqbYS6ZG5xh7AOX7Iei8GmqUhOo= 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 109FA3858CDA for ; Tue, 20 Sep 2022 08:43:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 109FA3858CDA Received: by mail-pf1-x42d.google.com with SMTP id u132so2087396pfc.6 for ; Tue, 20 Sep 2022 01:43: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; bh=TAUi3JpiLo/oOT/DSCXa3yaG3BTp50+WO0uBrce82A8=; b=crp7/bDMEu5SbAqFX9Ec93l7UomkCB9aXx6Yzt01PsfrX+ImG8htDzOvIH2WSJ59i1 rNEw+KkLB7t9MCxfowKNYCUyvJ2SFX5SWrgUFnII9nrRV0mN5ZfqWoJAx4/MgNkDabvx AxaDVvVETHT+uKT8D4RQqnrkb908zOYOXfmlpO3GDP//szajtUUpUTNwz3eY0hK/2TKB yU+4QNNqCaLXmq65febOU3NPMjCTe2vidD8AB6qxP0kaUwWyWzZ1Kc78VHkrtm6OSXZW Sh5qBh067l9WYfJ5aEnqvBH30yIkKB3v7KVyGSxjXEYMyEfu7EwxzHCaeb2X2jcfX6c9 PfTg== X-Gm-Message-State: ACrzQf3agR8Vjll4TQ9n5faVhAC+DS+zALuBY90of86gWkJqIvAntMgO z+0NnjrY4twJfSq3EovZIGjJUfzIwfM= X-Google-Smtp-Source: AMsMyM5Q/Ml9oXYCNdvob2pWEP4horiash1Q+5iuKAy6yt+/ZeZZEZv02tZ5zRKRDGI1bEHHpcbWPQ== X-Received: by 2002:a05:6a02:186:b0:431:25fb:f1fe with SMTP id bj6-20020a056a02018600b0043125fbf1femr19806339pgb.130.1663663403492; Tue, 20 Sep 2022 01:43:23 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id so16-20020a17090b1f9000b002009db534d1sm873372pjb.24.2022.09.20.01.43.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 01:43:23 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 1/7] Rename 'hello2.spec.' -> 'hello2.spec' 'hello3.spec.' -> 'hello3.spec' Date: Tue, 20 Sep 2022 16:43:01 +0800 Message-Id: <20220920084307.1696-2-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20220920084307.1696-1-luoyonggang@gmail.com> References: <20220920084307.1696-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.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" 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 85514898..fc2235f4 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -563,7 +563,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 Tue Sep 20 08:43: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: 57794 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 E7B983857B94 for ; Tue, 20 Sep 2022 08:43:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E7B983857B94 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663663428; bh=lYBEgAQjNgmv93kbkvWaoSui8DsMZ+ZTDYtGxDtXuWs=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=fypZlkQrC7yU43psnc3RxGqG/Iy4xUJ9pzvMJjn2ZYsHKa9bJG+gmUU4ep45tDk86 sfiIAi46lASXoTNk9srVEz0hZjLBKcoCL8VyFC35Y32tLCdsc6nqocEvGMjK9g8lPA UAT33cA+YBZxVsROqk0ttO5SXtKtlhBVyLLgW1aA= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by sourceware.org (Postfix) with ESMTPS id 849D23858C55 for ; Tue, 20 Sep 2022 08:43:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 849D23858C55 Received: by mail-pj1-x102f.google.com with SMTP id y11so2272277pjv.4 for ; Tue, 20 Sep 2022 01:43: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; bh=lYBEgAQjNgmv93kbkvWaoSui8DsMZ+ZTDYtGxDtXuWs=; b=iAoy8b0KiisY+8MWg6HWromnT6EImSe5lbVobylIMOO5b2XtnCaItGzPntBORTDxTI 67ukHsljgo9ECqk8SFFliSzmNhUf6CSzvBM4D5dSIkWKMLWWa8aCGwvqJGpT+UJfemCc w5I8Y5lHc0GUsObh8d3KRvbXsMivkevnBhpREswWaRkD0TdVXPdFi27/2ycjINyHNUJH rL3oFvv3vkmzluH1eCNdYBqImXLFPEAdffbtof3CtAxfLprC9uJOhlvKpT6KqhYE1IHg kMwZXLdQZTUXlLPOuP+XsxUSJ9FJLsQzESS5kmhTrvzr9r68m7iZMUz1C4pKAj3oqXRw md6A== X-Gm-Message-State: ACrzQf035MBz0RGa9YuxDdHQK8U98RYYv3oOfb/roMIKvzb0oG1k/7ZN 2yb7kZ7JEOXwsFR+eWlOzvIG+VZnrTM= X-Google-Smtp-Source: AMsMyM7nA2fpXr9BhNmn6vN7q4VSNkWPA0YiFkR8n8KsiOFs6Gg75B4DDPv7+6i4FvNYWHh/vu56hA== X-Received: by 2002:a17:90a:e644:b0:200:2f9a:bd0a with SMTP id ep4-20020a17090ae64400b002002f9abd0amr2723574pjb.88.1663663405238; Tue, 20 Sep 2022 01:43:25 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id so16-20020a17090b1f9000b002009db534d1sm873372pjb.24.2022.09.20.01.43.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 01:43:24 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 2/7] move platform depended include into system.h Date: Tue, 20 Sep 2022 16:43:02 +0800 Message-Id: <20220920084307.1696-3-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20220920084307.1696-1-luoyonggang@gmail.com> References: <20220920084307.1696-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.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" All of these files either #include directly or #include "libelfP.h" And now "libelfP.h also #include , so the platform depended include can be moved to system.h safely Signed-off-by: Yonggang Luo --- lib/system.h | 11 +++++++---- libebl/eblmachineflagname.c | 1 - libebl/eblobjnotetypename.c | 2 -- libebl/eblopenbackend.c | 1 - libelf/common.h | 3 --- libelf/elf32_checksum.c | 1 - libelf/elf32_getphdr.c | 2 -- libelf/elf32_getshdr.c | 2 -- libelf/elf32_updatefile.c | 3 --- libelf/elf32_updatenull.c | 2 -- libelf/elf32_xlatetof.c | 1 - libelf/elf32_xlatetom.c | 1 - libelf/elf_begin.c | 3 --- libelf/elf_cntl.c | 2 -- libelf/elf_compress.c | 2 -- libelf/elf_end.c | 1 - libelf/elf_error.c | 1 - libelf/elf_getarsym.c | 4 ---- libelf/elf_getdata.c | 2 -- libelf/elf_getdata_rawchunk.c | 2 -- libelf/elf_getshdrstrndx.c | 2 -- libelf/elf_readall.c | 2 -- libelf/elf_update.c | 2 -- libelf/gelf_xlate.c | 1 - libelf/libelfP.h | 1 + libelf/nlist.c | 1 - 26 files changed, 8 insertions(+), 48 deletions(-) diff --git a/lib/system.h b/lib/system.h index d3f42c91..48004df1 100644 --- a/lib/system.h +++ b/lib/system.h @@ -35,14 +35,17 @@ #include #include #include -#include -#include -#include -#include #include #include #include +/* System dependend headers */ +#include +#include +#include +#include +#include + #if defined(HAVE_ERROR_H) #include #elif defined(HAVE_ERR_H) diff --git a/libebl/eblmachineflagname.c b/libebl/eblmachineflagname.c index 02e11c65..5897735f 100644 --- a/libebl/eblmachineflagname.c +++ b/libebl/eblmachineflagname.c @@ -33,7 +33,6 @@ #include #include -#include #include diff --git a/libebl/eblobjnotetypename.c b/libebl/eblobjnotetypename.c index 473a1f2f..2ee1b228 100644 --- a/libebl/eblobjnotetypename.c +++ b/libebl/eblobjnotetypename.c @@ -31,8 +31,6 @@ # include #endif -#include - #include #include #include diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c index c6657252..9ba8728b 100644 --- a/libebl/eblopenbackend.c +++ b/libebl/eblopenbackend.c @@ -38,7 +38,6 @@ #include #include -#include #include Ebl *i386_init (Elf *, GElf_Half, Ebl *); diff --git a/libelf/common.h b/libelf/common.h index 3718b3fd..4561854f 100644 --- a/libelf/common.h +++ b/libelf/common.h @@ -30,9 +30,6 @@ #ifndef _COMMON_H #define _COMMON_H 1 -#include -#include -#include #include #include diff --git a/libelf/elf32_checksum.c b/libelf/elf32_checksum.c index c5f27bbe..521668a7 100644 --- a/libelf/elf32_checksum.c +++ b/libelf/elf32_checksum.c @@ -32,7 +32,6 @@ #endif #include -#include #include #include #include diff --git a/libelf/elf32_getphdr.c b/libelf/elf32_getphdr.c index 99b4ac09..4bfca24b 100644 --- a/libelf/elf32_getphdr.c +++ b/libelf/elf32_getphdr.c @@ -34,10 +34,8 @@ #include #include #include -#include #include -#include #include "libelfP.h" #include "common.h" diff --git a/libelf/elf32_getshdr.c b/libelf/elf32_getshdr.c index 237d9122..fc696302 100644 --- a/libelf/elf32_getshdr.c +++ b/libelf/elf32_getshdr.c @@ -34,9 +34,7 @@ #include #include #include -#include -#include #include "libelfP.h" #include "common.h" diff --git a/libelf/elf32_updatefile.c b/libelf/elf32_updatefile.c index 1ff58900..46afa1f4 100644 --- a/libelf/elf32_updatefile.c +++ b/libelf/elf32_updatefile.c @@ -37,10 +37,7 @@ #include #include #include -#include -#include -#include #include "libelfP.h" diff --git a/libelf/elf32_updatenull.c b/libelf/elf32_updatenull.c index d0d4d1eb..6c06e5e4 100644 --- a/libelf/elf32_updatenull.c +++ b/libelf/elf32_updatenull.c @@ -32,12 +32,10 @@ #endif #include -#include #include #include #include -#include #include "libelfP.h" #include "elf-knowledge.h" diff --git a/libelf/elf32_xlatetof.c b/libelf/elf32_xlatetof.c index 082d833f..377659c8 100644 --- a/libelf/elf32_xlatetof.c +++ b/libelf/elf32_xlatetof.c @@ -32,7 +32,6 @@ #endif #include -#include #include #include "libelfP.h" diff --git a/libelf/elf32_xlatetom.c b/libelf/elf32_xlatetom.c index cb0bb8d5..fa3dc9a7 100644 --- a/libelf/elf32_xlatetom.c +++ b/libelf/elf32_xlatetom.c @@ -32,7 +32,6 @@ #endif #include -#include #include #include "libelfP.h" diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c index 71eb3594..fe8c640a 100644 --- a/libelf/elf_begin.c +++ b/libelf/elf_begin.c @@ -39,11 +39,8 @@ #include #include #include -#include -#include #include -#include #include "libelfP.h" #include "common.h" diff --git a/libelf/elf_cntl.c b/libelf/elf_cntl.c index fd681789..04aa9132 100644 --- a/libelf/elf_cntl.c +++ b/libelf/elf_cntl.c @@ -31,8 +31,6 @@ # include #endif -#include - #include "libelfP.h" diff --git a/libelf/elf_compress.c b/libelf/elf_compress.c index df0144e8..d7f53af2 100644 --- a/libelf/elf_compress.c +++ b/libelf/elf_compress.c @@ -31,14 +31,12 @@ #endif #include -#include #include "libelfP.h" #include "common.h" #include #include #include -#include #include /* Cleanup and return result. Don't leak memory. */ diff --git a/libelf/elf_end.c b/libelf/elf_end.c index 160f0b88..5c451f36 100644 --- a/libelf/elf_end.c +++ b/libelf/elf_end.c @@ -34,7 +34,6 @@ #include #include #include -#include #include "libelfP.h" diff --git a/libelf/elf_error.c b/libelf/elf_error.c index 5364e685..e596108d 100644 --- a/libelf/elf_error.c +++ b/libelf/elf_error.c @@ -32,7 +32,6 @@ #endif #include -#include #include #include #include diff --git a/libelf/elf_getarsym.c b/libelf/elf_getarsym.c index 05ebf6a9..2203521f 100644 --- a/libelf/elf_getarsym.c +++ b/libelf/elf_getarsym.c @@ -32,16 +32,12 @@ #endif #include -#include -#include #include #include #include #include #include -#include -#include #include #include "libelfP.h" diff --git a/libelf/elf_getdata.c b/libelf/elf_getdata.c index a704aae3..5ebd270f 100644 --- a/libelf/elf_getdata.c +++ b/libelf/elf_getdata.c @@ -35,10 +35,8 @@ #include #include #include -#include #include "libelfP.h" -#include #include "common.h" #include "elf-knowledge.h" diff --git a/libelf/elf_getdata_rawchunk.c b/libelf/elf_getdata_rawchunk.c index 2f55cbb4..5a35ccdc 100644 --- a/libelf/elf_getdata_rawchunk.c +++ b/libelf/elf_getdata_rawchunk.c @@ -35,9 +35,7 @@ #include #include #include -#include -#include #include "libelfP.h" #include "common.h" diff --git a/libelf/elf_getshdrstrndx.c b/libelf/elf_getshdrstrndx.c index ad884fd3..2391317b 100644 --- a/libelf/elf_getshdrstrndx.c +++ b/libelf/elf_getshdrstrndx.c @@ -35,9 +35,7 @@ #include #include #include -#include -#include #include "libelfP.h" #include "common.h" diff --git a/libelf/elf_readall.c b/libelf/elf_readall.c index 0a3a233d..d0f9a28c 100644 --- a/libelf/elf_readall.c +++ b/libelf/elf_readall.c @@ -32,10 +32,8 @@ #endif #include -#include #include -#include #include "libelfP.h" #include "common.h" diff --git a/libelf/elf_update.c b/libelf/elf_update.c index 97ca9ca9..56af3a1c 100644 --- a/libelf/elf_update.c +++ b/libelf/elf_update.c @@ -33,8 +33,6 @@ #include #include -#include -#include #include #include "libelfP.h" diff --git a/libelf/gelf_xlate.c b/libelf/gelf_xlate.c index 6f8c57b7..d8ad0634 100644 --- a/libelf/gelf_xlate.c +++ b/libelf/gelf_xlate.c @@ -32,7 +32,6 @@ # include #endif -#include #include #include #include diff --git a/libelf/libelfP.h b/libelf/libelfP.h index 56331f45..d88a613c 100644 --- a/libelf/libelfP.h +++ b/libelf/libelfP.h @@ -39,6 +39,7 @@ #include #include +#include /* Helper Macros to write 32 bit and 64 bit functions. */ #define __elfw2_(Bits, Name) __elf##Bits##_##Name diff --git a/libelf/nlist.c b/libelf/nlist.c index 8593c1de..b3d60435 100644 --- a/libelf/nlist.c +++ b/libelf/nlist.c @@ -35,7 +35,6 @@ #include #include #include -#include #include "libelfP.h" From patchwork Tue Sep 20 08:43: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: 57791 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 A43263857C58 for ; Tue, 20 Sep 2022 08:43:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A43263857C58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663663418; bh=+Z3+udNJH98+4AML2iscOnkHda6umDzMFISsryd84GM=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=D0PifzPpbDdYnro71M1kVU5o54jG7rK3eSQspeWqiqpq94fjUa5isn78bs/ek439w 9ouKs5DclR9xLZsWB49p1QmhyYTxWV7UEJzAmRZwWWq222FALLmuko/2jJkfj8S3lP 6IDJESZmLcDZvoJr5KQZkwvV4LKWyapcrDam9+Jw= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by sourceware.org (Postfix) with ESMTPS id 14FDE3858C2F for ; Tue, 20 Sep 2022 08:43:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 14FDE3858C2F Received: by mail-pj1-x1036.google.com with SMTP id o99-20020a17090a0a6c00b002039c4fce53so4607788pjo.2 for ; Tue, 20 Sep 2022 01:43:28 -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; bh=+Z3+udNJH98+4AML2iscOnkHda6umDzMFISsryd84GM=; b=QLyOS7yKDlu1bUZJGDsu4xegeoDdTdQkVB1V5g5ClAPBN6438hKRUaPBw6IfBPLRu1 j/8c83n+E+BWIcu2jGigHdMo4A2FBhldIxZwjsvXvuvuAm8cdJjJWb9/tpjgET9RzDn8 GntnUghbWCRubJvp+v88muJlDbCWCuJT/eZN7Ry0wG8AuINnTGlohrXfAw9S54bXjG3h yKLm/woB0zk7MXrPH6ZKNqn2MKjgmvD5GbknzF8VP6kZQWXw69oCxQc+jqmFpTz2Y49Z dKcTZzjX/S8176Qug2xRk0W1cWrpZPLU0gmk6bAIuFc3mK58J1/nDWR90i1NYgNHhH6U L+DQ== X-Gm-Message-State: ACrzQf3IcjWs6TUk26ao05ReP+qPRrqMuZSKSQtzkZNrcEHYXG+H91IY ORVXZwSEXNaPu2JFf4v26MRfzCd0DQo= X-Google-Smtp-Source: AMsMyM4ZcnylG6PMLIpTrmdqRleXVqViODyayCF1Se2kLPnR0YKHuL55OzXN5EfSdJ6Ft+hVl9geKQ== X-Received: by 2002:a17:90b:2644:b0:1fa:e0be:4dcb with SMTP id pa4-20020a17090b264400b001fae0be4dcbmr2657406pjb.85.1663663406789; Tue, 20 Sep 2022 01:43:26 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id so16-20020a17090b1f9000b002009db534d1sm873372pjb.24.2022.09.20.01.43.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 01:43:26 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 3/7] lib: Use NOT_HAVE_LIBINTL to guard if need #include Date: Tue, 20 Sep 2022 16:43:03 +0800 Message-Id: <20220920084307.1696-4-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20220920084307.1696-1-luoyonggang@gmail.com> References: <20220920084307.1696-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.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" Signed-off-by: Yonggang Luo --- lib/eu-config.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/eu-config.h b/lib/eu-config.h index c7d7cbb2..5e6c3c72 100644 --- a/lib/eu-config.h +++ b/lib/eu-config.h @@ -52,9 +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 Tue Sep 20 08:43:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 57793 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 2E9C43857BA1 for ; Tue, 20 Sep 2022 08:43:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2E9C43857BA1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663663428; bh=t4LnKGThA86A/oYvjgBTyUPeDyOwQdu5F2P1eGbHWgE=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=uGb5ZMQebH3BFRVmvj8kjikpD24+TVcI5IzLCNPtVhd1hjmtw15Z3uT3ypVGmGHSQ pPlqFQdN/CJjc4ZN5O0P8h1UR/qTtNeR/0X5uTAK0z6J//Y6Gw2p9cejehu2lJ6aW6 U64mz5f1W5HU8EzgDHNw6uHsgCT3oVIVzNkKpOio= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by sourceware.org (Postfix) with ESMTPS id D82CE3858430 for ; Tue, 20 Sep 2022 08:43:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D82CE3858430 Received: by mail-pl1-x630.google.com with SMTP id w13so1699130plp.1 for ; Tue, 20 Sep 2022 01:43:29 -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; bh=t4LnKGThA86A/oYvjgBTyUPeDyOwQdu5F2P1eGbHWgE=; b=W/8FAPtTv7GIB5ZpIBQQfWD0MvXXu7fEzdkrsdYo11Za490Fj/kfcRo9so6glRoDy5 7PUTnyYTilLdPszbJQlKjSwPoAFwCxRQru8aYvlpZD158x2nQ3TjlW/3/UPHxjExxzxG mz9pvwvVihfaY09aJQcURRCoSmQWD0bcU2TQG+HmBv8Zo69itmelLcHPSx+pBbXBtItM gfAFl8Sg8F7Obdctsd+xSl/Wcq3wPKoGJlxfXFNcln7YxruqezE6eEUUwEjtiNu54gy+ s8ZeFNQz8YkbAHlb0mQt3ibxzxuj6ldV/Akc88GX+X13wAIlG7uwdaApwboe9DSlLr/n v/9A== X-Gm-Message-State: ACrzQf2bg/kOYXiv2prCDtulH/5gIPzmtGPUvSpbJlNt6f89HlHfmevZ 55zEXHzelkIFQP6v90klxhieCyPsCWI= X-Google-Smtp-Source: AMsMyM6C1iyTjIiJp2L1hMoygE0k2QfV4ddNRt/3fJ8fbwn3gciK2/PDKn3l8i9bodD0g4z7aA1C2Q== X-Received: by 2002:a17:90b:3ec1:b0:203:7c2a:af00 with SMTP id rm1-20020a17090b3ec100b002037c2aaf00mr2665900pjb.246.1663663408482; Tue, 20 Sep 2022 01:43:28 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id so16-20020a17090b1f9000b002009db534d1sm873372pjb.24.2022.09.20.01.43.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 01:43:28 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 4/7] Remove duplicated #include Date: Tue, 20 Sep 2022 16:43:04 +0800 Message-Id: <20220920084307.1696-5-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20220920084307.1696-1-luoyonggang@gmail.com> References: <20220920084307.1696-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.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 --- debuginfod/debuginfod.cxx | 1 - lib/color.c | 1 - lib/printversion.c | 1 - lib/xasprintf.c | 1 - lib/xmalloc.c | 1 - libasm/asm_end.c | 1 - libasm/asm_error.c | 1 - libasm/asm_newscn.c | 1 - libcpu/i386_lex.l | 1 - libcpu/i386_parse.y | 1 - libdw/libdwP.h | 1 - libdwfl/argp-std.c | 1 - libdwfl/dwfl_error.c | 1 - libebl/libeblP.h | 1 - src/addr2line.c | 1 - src/ar.c | 1 - src/arlib-argp.c | 1 - src/arlib.c | 1 - src/arlib2.c | 1 - src/elfcmp.c | 1 - src/elflint.c | 1 - src/findtextrel.c | 1 - src/nm.c | 1 - src/objdump.c | 1 - src/ranlib.c | 1 - src/readelf.c | 1 - src/size.c | 1 - src/strings.c | 1 - src/strip.c | 1 - src/unstrip.c | 1 - 30 files changed, 30 deletions(-) diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx index 000a41c4..8e7ee499 100644 --- a/debuginfod/debuginfod.cxx +++ b/debuginfod/debuginfod.cxx @@ -47,7 +47,6 @@ extern "C" { #include #include -#include #include #include #include diff --git a/lib/color.c b/lib/color.c index e43b6143..bd105ec2 100644 --- a/lib/color.c +++ b/lib/color.c @@ -32,7 +32,6 @@ #endif #include -#include #include #include #include diff --git a/lib/printversion.c b/lib/printversion.c index f657329c..7d31fa83 100644 --- a/lib/printversion.c +++ b/lib/printversion.c @@ -30,7 +30,6 @@ # include #endif -#include #include "printversion.h" void diff --git a/lib/xasprintf.c b/lib/xasprintf.c index 179ea2e8..d61fad90 100644 --- a/lib/xasprintf.c +++ b/lib/xasprintf.c @@ -33,7 +33,6 @@ #include #include #include -#include #include "libeu.h" #include "system.h" diff --git a/lib/xmalloc.c b/lib/xmalloc.c index 7c094985..de7211f1 100644 --- a/lib/xmalloc.c +++ b/lib/xmalloc.c @@ -30,7 +30,6 @@ # include #endif -#include #include #include #include diff --git a/libasm/asm_end.c b/libasm/asm_end.c index 077d2aa5..a26120f2 100644 --- a/libasm/asm_end.c +++ b/libasm/asm_end.c @@ -32,7 +32,6 @@ #endif #include -#include #include #include #include diff --git a/libasm/asm_error.c b/libasm/asm_error.c index cc3e660b..2b769395 100644 --- a/libasm/asm_error.c +++ b/libasm/asm_error.c @@ -31,7 +31,6 @@ # include #endif -#include #include #include diff --git a/libasm/asm_newscn.c b/libasm/asm_newscn.c index 1150015f..d258d969 100644 --- a/libasm/asm_newscn.c +++ b/libasm/asm_newscn.c @@ -32,7 +32,6 @@ #endif #include -#include #include #include diff --git a/libcpu/i386_lex.l b/libcpu/i386_lex.l index b6ec0f87..9b33ed95 100644 --- a/libcpu/i386_lex.l +++ b/libcpu/i386_lex.l @@ -31,7 +31,6 @@ #endif #include -#include #include #include "system.h" diff --git a/libcpu/i386_parse.y b/libcpu/i386_parse.y index 9a92c2e0..d2236d59 100644 --- a/libcpu/i386_parse.y +++ b/libcpu/i386_parse.y @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include diff --git a/libdw/libdwP.h b/libdw/libdwP.h index 56b388c1..961fa4e7 100644 --- a/libdw/libdwP.h +++ b/libdw/libdwP.h @@ -29,7 +29,6 @@ #ifndef _LIBDWP_H #define _LIBDWP_H 1 -#include #include #include diff --git a/libdwfl/argp-std.c b/libdwfl/argp-std.c index 01ec18e2..bc013aa0 100644 --- a/libdwfl/argp-std.c +++ b/libdwfl/argp-std.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include diff --git a/libdwfl/dwfl_error.c b/libdwfl/dwfl_error.c index a5c683a9..43fa1dcc 100644 --- a/libdwfl/dwfl_error.c +++ b/libdwfl/dwfl_error.c @@ -31,7 +31,6 @@ #endif #include -#include #include #include #include diff --git a/libebl/libeblP.h b/libebl/libeblP.h index fa1c2c9f..c408ed97 100644 --- a/libebl/libeblP.h +++ b/libebl/libeblP.h @@ -32,7 +32,6 @@ #include #include #include -#include /* Backend handle. */ diff --git a/src/addr2line.c b/src/addr2line.c index 25db2926..7768b266 100644 --- a/src/addr2line.c +++ b/src/addr2line.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/src/ar.c b/src/ar.c index 04456c18..3bcb18fe 100644 --- a/src/ar.c +++ b/src/ar.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/src/arlib-argp.c b/src/arlib-argp.c index a3c12e4d..115b9d76 100644 --- a/src/arlib-argp.c +++ b/src/arlib-argp.c @@ -20,7 +20,6 @@ #endif #include -#include #include "arlib.h" diff --git a/src/arlib.c b/src/arlib.c index c09fc3c6..b8f89ba7 100644 --- a/src/arlib.c +++ b/src/arlib.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include diff --git a/src/arlib2.c b/src/arlib2.c index 11f44e5d..9ae6662c 100644 --- a/src/arlib2.c +++ b/src/arlib2.c @@ -20,7 +20,6 @@ # include #endif -#include #include #include diff --git a/src/elfcmp.c b/src/elfcmp.c index 21d8d9dc..fba67e02 100644 --- a/src/elfcmp.c +++ b/src/elfcmp.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include diff --git a/src/elflint.c b/src/elflint.c index b0e5415e..565cffdc 100644 --- a/src/elflint.c +++ b/src/elflint.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include diff --git a/src/findtextrel.c b/src/findtextrel.c index ecb1d118..d3021a3a 100644 --- a/src/findtextrel.c +++ b/src/findtextrel.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff --git a/src/nm.c b/src/nm.c index 16647589..b46c1fd7 100644 --- a/src/nm.c +++ b/src/nm.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include diff --git a/src/objdump.c b/src/objdump.c index b32de17d..d43c1dd6 100644 --- a/src/objdump.c +++ b/src/objdump.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include diff --git a/src/ranlib.c b/src/ranlib.c index bd7e1d8a..7838d69e 100644 --- a/src/ranlib.c +++ b/src/ranlib.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff --git a/src/readelf.c b/src/readelf.c index 1a10fd01..a206e60e 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include diff --git a/src/size.c b/src/size.c index 8f203167..ff8ca075 100644 --- a/src/size.c +++ b/src/size.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include diff --git a/src/strings.c b/src/strings.c index 04aac3b6..55b047be 100644 --- a/src/strings.c +++ b/src/strings.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/src/strip.c b/src/strip.c index 452b1279..2a2cc801 100644 --- a/src/strip.c +++ b/src/strip.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/src/unstrip.c b/src/unstrip.c index 3472637a..d5bd1821 100644 --- a/src/unstrip.c +++ b/src/unstrip.c @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include From patchwork Tue Sep 20 08:43:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 57795 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 072AC385828F for ; Tue, 20 Sep 2022 08:43:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 072AC385828F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663663439; bh=XJH8B5jDSHMHlMB23vE6Yt+3LA4cEe8gIizwyTIsdUQ=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=gB6w+7t0GXKBblo1WoKNVJI+o+euUV1Q5sy69SHR6vXZjuUspNXHV8gPVmEKQRkbO Cw3cW5F9TuxIcBm9l5LpBfaJsLxFSTqlrKc0MHDGZXTtMVIUJaqyOwrv3PqaKOScKA VPkkXWtxL3B/SfJOqSM2Flzl8N712BuhDB94rnvo= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id A74EB3858295 for ; Tue, 20 Sep 2022 08:43:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A74EB3858295 Received: by mail-pl1-x62e.google.com with SMTP id p18so1671101plr.8 for ; Tue, 20 Sep 2022 01:43:31 -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; bh=XJH8B5jDSHMHlMB23vE6Yt+3LA4cEe8gIizwyTIsdUQ=; b=CmJNisRXSIW5AHLu0UTumOoPWDk04u8YoAONctZVcLPxglSX+eP+wqmawDLehPXkbS DM2tMXb004J6ayhsvPV2DPX1ySqXQ3h9HwQU/2CZqCTIXqu8YmuKayN6KWjdfxWSrU/Z KKXGiS6O4hFtjN44Qzx3ycYoRYQ2nNHUBWGWD5sahr143/37jX1/6/pi3EpqC8E32How MnibT30Z39Bpp3zqLh4ik5C4bBIbDCdxRwHji0iWOZoxd74nqqJIL8EW1D1K87yRvNrX iGfPdxaaZdrcWo/sjxLxtI37x6sO5d8aAsvXcTj6P+/AIEcDE+WgeYahJp3CjbmiMTG7 LxOg== X-Gm-Message-State: ACrzQf30xYSQSrmGrUpCRuByvtO2UxjDClxpHA2WL+ugbeFiTVQ75IIB Sfx+D3hP7/XTgt+oTPwmDvAYYxGO8xY= X-Google-Smtp-Source: AMsMyM6x9YcaqqHYilOXUuZEOhOAKgm20J1vXshzdC3Pn+7WbnOWViQvb8J25oZ4G46nKBamWeQw1g== X-Received: by 2002:a17:90b:3b90:b0:202:8a60:c852 with SMTP id pc16-20020a17090b3b9000b002028a60c852mr2748522pjb.169.1663663410293; Tue, 20 Sep 2022 01:43:30 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id so16-20020a17090b1f9000b002009db534d1sm873372pjb.24.2022.09.20.01.43.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 01:43:29 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 5/7] Strip __ prefix from __BYTE_ORDER __LITTLE_ENDIAN and __BIG_ENDIAN Date: Tue, 20 Sep 2022 16:43:05 +0800 Message-Id: <20220920084307.1696-6-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20220920084307.1696-1-luoyonggang@gmail.com> References: <20220920084307.1696-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.5 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/system.h | 4 ++-- libcpu/i386_disasm.c | 2 +- libcpu/memory-access.h | 26 +++++++++++++------------- libcpu/riscv_disasm.c | 2 +- libdw/memory-access.h | 8 ++++---- libdwfl/dwfl_segment_report_module.c | 2 +- libelf/common.h | 2 +- libelf/elf32_checksum.c | 4 ++-- libelf/elf32_xlatetof.c | 4 ++-- libelf/elf_getarsym.c | 6 +++--- src/arlib.h | 2 +- 11 files changed, 31 insertions(+), 31 deletions(-) diff --git a/lib/system.h b/lib/system.h index 48004df1..bbbe06c4 100644 --- a/lib/system.h +++ b/lib/system.h @@ -64,12 +64,12 @@ void error(int status, int errnum, const char *format, ...); exit (EXIT_FAILURE); \ } while (0) -#if __BYTE_ORDER == __LITTLE_ENDIAN +#if BYTE_ORDER == LITTLE_ENDIAN # define LE32(n) (n) # define LE64(n) (n) # define BE32(n) bswap_32 (n) # define BE64(n) bswap_64 (n) -#elif __BYTE_ORDER == __BIG_ENDIAN +#elif BYTE_ORDER == BIG_ENDIAN # define BE32(n) (n) # define BE64(n) (n) # define LE32(n) bswap_32 (n) diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c index fd7340cc..40475b81 100644 --- a/libcpu/i386_disasm.c +++ b/libcpu/i386_disasm.c @@ -44,7 +44,7 @@ #include "../libebl/libeblP.h" -#define MACHINE_ENCODING __LITTLE_ENDIAN +#define MACHINE_ENCODING LITTLE_ENDIAN #include "memory-access.h" diff --git a/libcpu/memory-access.h b/libcpu/memory-access.h index 779825fa..3b6ca19b 100644 --- a/libcpu/memory-access.h +++ b/libcpu/memory-access.h @@ -41,7 +41,7 @@ #ifndef MACHINE_ENCODING # error "MACHINE_ENCODING needs to be defined" #endif -#if MACHINE_ENCODING != __BIG_ENDIAN && MACHINE_ENCODING != __LITTLE_ENDIAN +#if MACHINE_ENCODING != BIG_ENDIAN && MACHINE_ENCODING != LITTLE_ENDIAN # error "MACHINE_ENCODING must signal either big or little endian" #endif @@ -51,31 +51,31 @@ #if ALLOW_UNALIGNED # define read_2ubyte_unaligned(Addr) \ - (unlikely (MACHINE_ENCODING != __BYTE_ORDER) \ + (unlikely (MACHINE_ENCODING != BYTE_ORDER) \ ? bswap_16 (*((const uint16_t *) (Addr))) \ : *((const uint16_t *) (Addr))) # define read_2sbyte_unaligned(Addr) \ - (unlikely (MACHINE_ENCODING != __BYTE_ORDER) \ + (unlikely (MACHINE_ENCODING != BYTE_ORDER) \ ? (int16_t) bswap_16 (*((const int16_t *) (Addr))) \ : *((const int16_t *) (Addr))) # define read_4ubyte_unaligned_noncvt(Addr) \ *((const uint32_t *) (Addr)) # define read_4ubyte_unaligned(Addr) \ - (unlikely (MACHINE_ENCODING != __BYTE_ORDER) \ + (unlikely (MACHINE_ENCODING != BYTE_ORDER) \ ? bswap_32 (*((const uint32_t *) (Addr))) \ : *((const uint32_t *) (Addr))) # define read_4sbyte_unaligned(Addr) \ - (unlikely (MACHINE_ENCODING != __BYTE_ORDER) \ + (unlikely (MACHINE_ENCODING != BYTE_ORDER) \ ? (int32_t) bswap_32 (*((const int32_t *) (Addr))) \ : *((const int32_t *) (Addr))) # define read_8ubyte_unaligned(Addr) \ - (unlikely (MACHINE_ENCODING != __BYTE_ORDER) \ + (unlikely (MACHINE_ENCODING != BYTE_ORDER) \ ? bswap_64 (*((const uint64_t *) (Addr))) \ : *((const uint64_t *) (Addr))) # define read_8sbyte_unaligned(Addr) \ - (unlikely (MACHINE_ENCODING != __BYTE_ORDER) \ + (unlikely (MACHINE_ENCODING != BYTE_ORDER) \ ? (int64_t) bswap_64 (*((const int64_t *) (Addr))) \ : *((const int64_t *) (Addr))) @@ -96,7 +96,7 @@ static inline uint16_t read_2ubyte_unaligned (const void *p) { const union unaligned *up = p; - if (MACHINE_ENCODING != __BYTE_ORDER) + if (MACHINE_ENCODING != BYTE_ORDER) return bswap_16 (up->u2); return up->u2; } @@ -104,7 +104,7 @@ static inline int16_t read_2sbyte_unaligned (const void *p) { const union unaligned *up = p; - if (MACHINE_ENCODING != __BYTE_ORDER) + if (MACHINE_ENCODING != BYTE_ORDER) return (int16_t) bswap_16 (up->u2); return up->s2; } @@ -119,7 +119,7 @@ static inline uint32_t read_4ubyte_unaligned (const void *p) { const union unaligned *up = p; - if (MACHINE_ENCODING != __BYTE_ORDER) + if (MACHINE_ENCODING != BYTE_ORDER) return bswap_32 (up->u4); return up->u4; } @@ -127,7 +127,7 @@ static inline int32_t read_4sbyte_unaligned (const void *p) { const union unaligned *up = p; - if (MACHINE_ENCODING != __BYTE_ORDER) + if (MACHINE_ENCODING != BYTE_ORDER) return (int32_t) bswap_32 (up->u4); return up->s4; } @@ -136,7 +136,7 @@ static inline uint64_t read_8ubyte_unaligned (const void *p) { const union unaligned *up = p; - if (MACHINE_ENCODING != __BYTE_ORDER) + if (MACHINE_ENCODING != BYTE_ORDER) return bswap_64 (up->u8); return up->u8; } @@ -144,7 +144,7 @@ static inline int64_t read_8sbyte_unaligned (const void *p) { const union unaligned *up = p; - if (MACHINE_ENCODING != __BYTE_ORDER) + if (MACHINE_ENCODING != BYTE_ORDER) return (int64_t) bswap_64 (up->u8); return up->s8; } diff --git a/libcpu/riscv_disasm.c b/libcpu/riscv_disasm.c index bc0d8f37..7175c077 100644 --- a/libcpu/riscv_disasm.c +++ b/libcpu/riscv_disasm.c @@ -41,7 +41,7 @@ #include "../libebl/libeblP.h" -#define MACHINE_ENCODING __LITTLE_ENDIAN +#define MACHINE_ENCODING LITTLE_ENDIAN #include "memory-access.h" diff --git a/libdw/memory-access.h b/libdw/memory-access.h index 8b2386ee..800b517c 100644 --- a/libdw/memory-access.h +++ b/libdw/memory-access.h @@ -355,10 +355,10 @@ read_8sbyte_unaligned_1 (bool other_byte_order, const void *p) static inline int file_byte_order (bool other_byte_order) { -#if __BYTE_ORDER == __LITTLE_ENDIAN - return other_byte_order ? __BIG_ENDIAN : __LITTLE_ENDIAN; +#if BYTE_ORDER == LITTLE_ENDIAN + return other_byte_order ? BIG_ENDIAN : LITTLE_ENDIAN; #else - return other_byte_order ? __LITTLE_ENDIAN : __BIG_ENDIAN; + return other_byte_order ? LITTLE_ENDIAN : BIG_ENDIAN; #endif } @@ -372,7 +372,7 @@ read_3ubyte_unaligned (Dwarf *dbg, const unsigned char *p) } d; bool other_byte_order = dbg->other_byte_order; - if (file_byte_order (other_byte_order) == __BIG_ENDIAN) + if (file_byte_order (other_byte_order) == BIG_ENDIAN) { d.c[0] = 0x00; d.c[1] = p[0]; diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c index 1461ae26..28f87f10 100644 --- a/libdwfl/dwfl_segment_report_module.c +++ b/libdwfl/dwfl_segment_report_module.c @@ -49,7 +49,7 @@ #define INITIAL_READ 1024 -#if __BYTE_ORDER == __LITTLE_ENDIAN +#if BYTE_ORDER == LITTLE_ENDIAN # define MY_ELFDATA ELFDATA2LSB #else # define MY_ELFDATA ELFDATA2MSB diff --git a/libelf/common.h b/libelf/common.h index 4561854f..9b2a856d 100644 --- a/libelf/common.h +++ b/libelf/common.h @@ -151,7 +151,7 @@ libelf_release_all (Elf *elf) : bswap_64 (Var)))) -#if __BYTE_ORDER == __LITTLE_ENDIAN +#if BYTE_ORDER == LITTLE_ENDIAN # define MY_ELFDATA ELFDATA2LSB #else # define MY_ELFDATA ELFDATA2MSB diff --git a/libelf/elf32_checksum.c b/libelf/elf32_checksum.c index 521668a7..a47b307d 100644 --- a/libelf/elf32_checksum.c +++ b/libelf/elf32_checksum.c @@ -73,9 +73,9 @@ elfw2(LIBELFBITS,checksum) (Elf *elf) is the same. */ ident = elf->state.ELFW(elf,LIBELFBITS).ehdr->e_ident; same_byte_order = ((ident[EI_DATA] == ELFDATA2LSB - && __BYTE_ORDER == __LITTLE_ENDIAN) + && BYTE_ORDER == LITTLE_ENDIAN) || (ident[EI_DATA] == ELFDATA2MSB - && __BYTE_ORDER == __BIG_ENDIAN)); + && BYTE_ORDER == BIG_ENDIAN)); /* If we don't have native byte order, we will likely need to convert the data with xlate functions. We do it upfront instead diff --git a/libelf/elf32_xlatetof.c b/libelf/elf32_xlatetof.c index 377659c8..ab857409 100644 --- a/libelf/elf32_xlatetof.c +++ b/libelf/elf32_xlatetof.c @@ -82,8 +82,8 @@ elfw2(LIBELFBITS, xlatetof) (Elf_Data *dest, const Elf_Data *src, and vice versa since the function only has to copy and/or change the byte order. */ - if ((__BYTE_ORDER == __LITTLE_ENDIAN && encode == ELFDATA2LSB) - || (__BYTE_ORDER == __BIG_ENDIAN && encode == ELFDATA2MSB)) + if ((BYTE_ORDER == LITTLE_ENDIAN && encode == ELFDATA2LSB) + || (BYTE_ORDER == BIG_ENDIAN && encode == ELFDATA2MSB)) { /* We simply have to copy since the byte order is the same. */ if (src->d_buf != dest->d_buf) diff --git a/libelf/elf_getarsym.c b/libelf/elf_getarsym.c index 2203521f..281f0c1c 100644 --- a/libelf/elf_getarsym.c +++ b/libelf/elf_getarsym.c @@ -61,7 +61,7 @@ read_number_entries (uint64_t *nump, Elf *elf, size_t *offp, bool index64_p) *offp += w; - if (__BYTE_ORDER == __LITTLE_ENDIAN) + if (BYTE_ORDER == LITTLE_ENDIAN) *nump = index64_p ? bswap_64 (u.ret64) : bswap_32 (u.ret32); else *nump = index64_p ? u.ret64 : u.ret32; @@ -266,7 +266,7 @@ elf_getarsym (Elf *elf, size_t *ptr) if (index64_p) { uint64_t tmp = (*u64)[cnt]; - if (__BYTE_ORDER == __LITTLE_ENDIAN) + if (BYTE_ORDER == LITTLE_ENDIAN) tmp = bswap_64 (tmp); arsym[cnt].as_off = tmp; @@ -286,7 +286,7 @@ elf_getarsym (Elf *elf, size_t *ptr) goto out; } } - else if (__BYTE_ORDER == __LITTLE_ENDIAN) + else if (BYTE_ORDER == LITTLE_ENDIAN) arsym[cnt].as_off = bswap_32 ((*u32)[cnt]); else arsym[cnt].as_off = (*u32)[cnt]; diff --git a/src/arlib.h b/src/arlib.h index e117166e..d4a42210 100644 --- a/src/arlib.h +++ b/src/arlib.h @@ -46,7 +46,7 @@ extern const struct argp_child arlib_argp_children[]; #define AR_HDR_WORDS (sizeof (struct ar_hdr) / sizeof (uint32_t)) -#if __BYTE_ORDER == __LITTLE_ENDIAN +#if BYTE_ORDER == LITTLE_ENDIAN # define le_bswap_32(val) bswap_32 (val) #else # define le_bswap_32(val) (val) From patchwork Tue Sep 20 08:43:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 57792 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 4715C38582B2 for ; Tue, 20 Sep 2022 08:43:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4715C38582B2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663663426; bh=Rs24UiwdDaCZ1guz21WLvtpkScGmDpLNu3yF2ODDIPE=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=v08UYfs3zf2aF/04Xm01B9gUM8TbXh8vxbkuGkRB9KKEiVp9RClT8nKd9G6VsUjzg SFaPp9DMshHWHULwjtEM/DRwENSYvFB4w9cYyigzKZGQU380fa6SkVYHPJqL3UnR8v ooX91JTjzQwUF+xUpa8oPvpHm35qsyOH7TBbausQ= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by sourceware.org (Postfix) with ESMTPS id A89AF38582B8 for ; Tue, 20 Sep 2022 08:43:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A89AF38582B8 Received: by mail-pj1-x102c.google.com with SMTP id s14-20020a17090a6e4e00b0020057c70943so10080044pjm.1 for ; Tue, 20 Sep 2022 01:43:33 -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; bh=Rs24UiwdDaCZ1guz21WLvtpkScGmDpLNu3yF2ODDIPE=; b=DY6hSUvMAekSsUxCQKgwSSOOI1R/mVwok5lvY0Jw+SEvith7HNw21R4EJooZ+6IFsc zUhSH40oDztcsLIwkEDfQw9ghBN6JQJGh/IjD4YK8CH130u68PCURvx2iBf0z5rD81Yw SgLXXr/S6NYKOi/3gMobL42p02v+B+j/sLz0qaaMBHUF/6ctSWyt/qFXYl538Ga3Vrr7 DI1Dq5VMaO+hBZP1yk8GeWJXLG+dXUwDHaB1Opv7HqkTTzl8oVytKa8npcNcQYLUz36j ROsx1r3JJMvwbP6mAoWWf0gQOrGS8IzvCbwrgRDQ9a9Wrpud5qQM6wXgyD84tKoVpLME 3vzA== X-Gm-Message-State: ACrzQf1mpUiIkMhnbudQzwKezSNvOM8Gg/ajFsKhZHjIzoQmBUP/0aEY B6BqyuT5W9296CAp5rX1lraP/fHQAMA= X-Google-Smtp-Source: AMsMyM6WFVvTsXJvGkJHGNIF0tYwAnIamQWuAErOtsNRMgRGB7Oa4evWuY0yuTm9KNORix7WwhoZoQ== X-Received: by 2002:a17:90b:3ec7:b0:202:b984:8436 with SMTP id rm7-20020a17090b3ec700b00202b9848436mr2775433pjb.4.1663663412238; Tue, 20 Sep 2022 01:43:32 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id so16-20020a17090b1f9000b002009db534d1sm873372pjb.24.2022.09.20.01.43.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 01:43:31 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 6/7] Fixes building with msvc/clang mingw/gcc Date: Tue, 20 Sep 2022 16:43:06 +0800 Message-Id: <20220920084307.1696-7-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20220920084307.1696-1-luoyonggang@gmail.com> References: <20220920084307.1696-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, 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 --- configure.ac | 1 + lib/system.h | 61 +++++++++++++- lib/system_win32.c | 162 ++++++++++++++++++++++++++++++++++++++ libelf/elf32_updatefile.c | 3 +- libelf/elf_begin.c | 7 +- libelf/elf_end.c | 2 + libelf/elf_update.c | 5 +- libelf/libelf.h | 6 ++ libelf/libelfP.h | 4 + libelf/win32/ar.h | 52 ++++++++++++ 10 files changed, 298 insertions(+), 5 deletions(-) create mode 100644 lib/system_win32.c create mode 100644 libelf/win32/ar.h 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/system.h b/lib/system.h index bbbe06c4..05b5cf8d 100644 --- a/lib/system.h +++ b/lib/system.h @@ -40,21 +40,78 @@ #include /* System dependend headers */ +#if !defined(_WIN32) #include #include -#include +#endif + +#if defined(_MSC_VER) +#include +#include +#include +#include +#include +typedef SSIZE_T ssize_t; +#else #include #include +#endif + +#if HAVE_DECL_MMAP +#include +#endif #if defined(HAVE_ERROR_H) #include -#elif defined(HAVE_ERR_H) +#elif defined(HAVE_ERR_H) || defined(_MSC_VER) 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 +#if defined(_MSC_VER) +#define BIG_ENDIAN 4321 +#define LITTLE_ENDIAN 1234 +#define BYTE_ORDER LITTLE_ENDIAN +static inline int ftruncate(int fd, off_t length) +{ + return _chsize_s(fd, length); +} +#endif /* defined(_MSC_VER) */ + +#if defined(_WIN32) +static inline uint16_t bswap_16(uint16_t x) { + return ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)); +} + +static inline uint32_t bswap_32(uint32_t x) { + return ( + (((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | + (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24) + ); +} + +static inline uint64_t bswap_64(uint64_t x) { + return ( + (((x) & 0xff00000000000000ull) >> 56) | + (((x) & 0x00ff000000000000ull) >> 40) | + (((x) & 0x0000ff0000000000ull) >> 24) | + (((x) & 0x000000ff00000000ull) >> 8) | + (((x) & 0x00000000ff000000ull) << 8) | + (((x) & 0x0000000000ff0000ull) << 24) | + (((x) & 0x000000000000ff00ull) << 40) | + (((x) & 0x00000000000000ffull) << 56) + ); +} + +#define htobe64(x) bswap_64(x) +#define be64toh(x) bswap_64(x) + +ssize_t pread(int fd, void *buf, size_t count, off_t offset); +ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset); +#endif /* defined(_WIN32) */ + /* error (EXIT_FAILURE, ...) should be noreturn but on some systems it isn't. This may cause warnings about code that should not be reachable. So have an explicit error_exit wrapper that is noreturn (because it diff --git a/lib/system_win32.c b/lib/system_win32.c new file mode 100644 index 00000000..d9941cc5 --- /dev/null +++ b/lib/system_win32.c @@ -0,0 +1,162 @@ +/* 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 +#include "system.h" + +#include + +static const struct +{ + DWORD winerr; + int doserr; +} doserrors[] = + + { + {ERROR_INVALID_FUNCTION, EINVAL}, + {ERROR_FILE_NOT_FOUND, ENOENT}, + {ERROR_PATH_NOT_FOUND, ENOENT}, + {ERROR_TOO_MANY_OPEN_FILES, EMFILE}, + {ERROR_ACCESS_DENIED, EACCES}, + {ERROR_INVALID_HANDLE, EBADF}, + {ERROR_ARENA_TRASHED, ENOMEM}, + {ERROR_NOT_ENOUGH_MEMORY, ENOMEM}, + {ERROR_INVALID_BLOCK, ENOMEM}, + {ERROR_BAD_ENVIRONMENT, E2BIG}, + {ERROR_BAD_FORMAT, ENOEXEC}, + {ERROR_INVALID_ACCESS, EINVAL}, + {ERROR_INVALID_DATA, EINVAL}, + {ERROR_INVALID_DRIVE, ENOENT}, + {ERROR_CURRENT_DIRECTORY, EACCES}, + {ERROR_NOT_SAME_DEVICE, EXDEV}, + {ERROR_NO_MORE_FILES, ENOENT}, + {ERROR_LOCK_VIOLATION, EACCES}, + {ERROR_SHARING_VIOLATION, EACCES}, + {ERROR_BAD_NETPATH, ENOENT}, + {ERROR_NETWORK_ACCESS_DENIED, EACCES}, + {ERROR_BAD_NET_NAME, ENOENT}, + {ERROR_FILE_EXISTS, EEXIST}, + {ERROR_CANNOT_MAKE, EACCES}, + {ERROR_FAIL_I24, EACCES}, + {ERROR_INVALID_PARAMETER, EINVAL}, + {ERROR_NO_PROC_SLOTS, EAGAIN}, + {ERROR_DRIVE_LOCKED, EACCES}, + {ERROR_BROKEN_PIPE, EPIPE}, + {ERROR_DISK_FULL, ENOSPC}, + {ERROR_INVALID_TARGET_HANDLE, EBADF}, + {ERROR_INVALID_HANDLE, EINVAL}, + {ERROR_WAIT_NO_CHILDREN, ECHILD}, + {ERROR_CHILD_NOT_COMPLETE, ECHILD}, + {ERROR_DIRECT_ACCESS_HANDLE, EBADF}, + {ERROR_NEGATIVE_SEEK, EINVAL}, + {ERROR_SEEK_ON_DEVICE, EACCES}, + {ERROR_DIR_NOT_EMPTY, ENOTEMPTY}, + {ERROR_NOT_LOCKED, EACCES}, + {ERROR_BAD_PATHNAME, ENOENT}, + {ERROR_MAX_THRDS_REACHED, EAGAIN}, + {ERROR_LOCK_FAILED, EACCES}, + {ERROR_ALREADY_EXISTS, EEXIST}, + {ERROR_FILENAME_EXCED_RANGE, ENOENT}, + {ERROR_NESTING_NOT_ALLOWED, EAGAIN}, + {ERROR_NOT_ENOUGH_QUOTA, ENOMEM}, + {ERROR_DELETE_PENDING, ENOENT}}; + +static void +_dosmaperr(unsigned long e) +{ + int i; + + if (e == 0) + { + errno = 0; + return; + } + + for (i = 0; i < sizeof(doserrors) / sizeof(doserrors[0]); i++) + { + if (doserrors[i].winerr == e) + { + int doserr = doserrors[i].doserr; + + errno = doserr; + return; + } + } + + errno = EINVAL; +} + +ssize_t +pread(int fd, void *buf, size_t count, off_t offset) +{ + OVERLAPPED overlapped = {0}; + HANDLE h; + DWORD ret; + + h = (HANDLE)_get_osfhandle(fd); + if (h == INVALID_HANDLE_VALUE) + { + errno = EBADF; + return -1; + } + + overlapped.Offset = offset; + if (!ReadFile(h, buf, count, &ret, &overlapped)) + { + if (GetLastError() == ERROR_HANDLE_EOF) + return 0; + + _dosmaperr(GetLastError()); + return -1; + } + + return ret; +} + +ssize_t +pwrite(int fd, const void *buf, size_t count, off_t offset) +{ + OVERLAPPED overlapped = {0}; + HANDLE h; + DWORD ret; + + h = (HANDLE)_get_osfhandle(fd); + if (h == INVALID_HANDLE_VALUE) + { + errno = EBADF; + return -1; + } + + overlapped.Offset = offset; + if (!WriteFile(h, buf, count, &ret, &overlapped)) + { + _dosmaperr(GetLastError()); + return -1; + } + + return ret; +} 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..d867cd6f 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. */ @@ -1160,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) { 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; 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; diff --git a/libelf/libelfP.h b/libelf/libelfP.h index d88a613c..14b60bce 100644 --- a/libelf/libelfP.h +++ b/libelf/libelfP.h @@ -30,7 +30,11 @@ #ifndef _LIBELFP_H #define _LIBELFP_H 1 +#if defined(_WIN32) +#include "win32/ar.h" +#else #include +#endif #include #include diff --git a/libelf/win32/ar.h b/libelf/win32/ar.h new file mode 100644 index 00000000..d67fab52 --- /dev/null +++ b/libelf/win32/ar.h @@ -0,0 +1,52 @@ +/* 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 . */ + +#ifndef _AR_H +#define _AR_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define ARMAG "!\n" +#define SARMAG 8 +#define ARFMAG "`\n" + +struct ar_hdr { + char ar_name[16]; + char ar_date[12]; + char ar_uid[6], ar_gid[6]; + char ar_mode[8]; + char ar_size[10]; + char ar_fmag[2]; +}; + +#ifdef __cplusplus +} +#endif + +#endif From patchwork Tue Sep 20 08:43:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 57796 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 8582C3858438 for ; Tue, 20 Sep 2022 08:44:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8582C3858438 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663663449; bh=KPpI3MM/ptSbbT/IfScB6MhifL9VYT60niWWLIwMoAk=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=wWBx2O+bku8DoCnkHbtFL2AZPWlcJ/0c8cbXUGG7/P+7r7H+KbACT8+DiA4BSthlN oefof95l+Z6PMKrRZThAGQPaxvefYmG5zr5aYaRdd2fFzaneBYIeFbdMx+4ECqZvwb 6LEctH3+1p+XkjiJAcNg0VJNhRg72nwQ8Zq6Kwf4= 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 4B1C13858028 for ; Tue, 20 Sep 2022 08:43:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4B1C13858028 Received: by mail-pf1-x42e.google.com with SMTP id b75so2088264pfb.7 for ; Tue, 20 Sep 2022 01:43:35 -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; bh=KPpI3MM/ptSbbT/IfScB6MhifL9VYT60niWWLIwMoAk=; b=H5fngzl/3ShN6cbib94mZGWU6wfqg56y/PDu9uhvYwyCKOKX+sMpnjVNdY0BVKFNrZ lNdWG1OWUXaQBzlsndYJGiehYQTpNKO4UeQCRfvmAyidkdFPE0cEuwxWUZ/BTUQpILtZ uo3teFzNwPFE+eb3vZGjPnZHrM+lvbdkebdCm5HFm0ggXs56mbRfmtxaPSYKYI/21Ybr R3OMtWdZ3a3wCjnCeXswatBZgH2yYA8qmYxy3uktjQkSug/BfQW7aGcTZOAiBpkvcpVl TSwARdBgwM4QhA2qy9ah/VMGukUdUzJETkBZxW00w9M4EQjNoDsjj1lRV116VZmQVhGr QF6g== X-Gm-Message-State: ACrzQf3Q8qCuv/LJb9jcNVb0iTpRbtD6x32E5TqQa4ZFLKEWodYuAjSb o2KysfB+kFaqjMaZf2etCabzQNnv+S0= X-Google-Smtp-Source: AMsMyM7uGe87hHaYSYr8DBWzybsAyZvbCvp0AikjvZOVjuSGOcrSFM3nv0yoXKpVHZzFqFjGx8bj9A== X-Received: by 2002:a63:904c:0:b0:435:eb3:83da with SMTP id a73-20020a63904c000000b004350eb383damr19769272pge.612.1663663413925; Tue, 20 Sep 2022 01:43:33 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id so16-20020a17090b1f9000b002009db534d1sm873372pjb.24.2022.09.20.01.43.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 01:43:33 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 7/7] Add CMake build files Date: Tue, 20 Sep 2022 16:43:07 +0800 Message-Id: <20220920084307.1696-8-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20220920084307.1696-1-luoyonggang@gmail.com> References: <20220920084307.1696-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, 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 --- .gitignore | 1 + CMakeLists.txt | 47 +++++++++ libelf/CMakeLists.txt | 192 +++++++++++++++++++++++++++++++++++ libelf/config-cmake/config.h | 27 +++++ 4 files changed, 267 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 libelf/CMakeLists.txt create mode 100644 libelf/config-cmake/config.h 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 diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..11ad5c13 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,47 @@ +# 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 the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# 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 a copy of the GNU General Public License +# along with this program. If not, see . + +cmake_minimum_required(VERSION 3.16) +project(libelf + LANGUAGES C + VERSION 0.187 +) + +add_subdirectory(libelf) + +include(GNUInstallDirs) + +if (LIBELF_INSTALL) + # Install the targets + install(TARGETS elf + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libelf + ) + set(VERSION ${CMAKE_PROJECT_VERSION}) + set(prefix ${CMAKE_INSTALL_PREFIX}) + set(exec_prefix "\${prefix}") + set(libdir "\${exec_prefix}/lib") + set(includedir "\${prefix}/include/libelf") + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/config/libelf.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/libelf.pc + @ONLY + ) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/libelf.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig + ) +endif() diff --git a/libelf/CMakeLists.txt b/libelf/CMakeLists.txt new file mode 100644 index 00000000..dc8f9291 --- /dev/null +++ b/libelf/CMakeLists.txt @@ -0,0 +1,192 @@ +# 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 the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# 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 a copy of the GNU General Public License +# along with this program. If not, see . + +add_library(elf + elf_begin.c + elf_clone.c + elf_cntl.c + elf_compress_gnu.c + elf_compress.c + elf_end.c + elf_error.c + elf_fill.c + elf_flagdata.c + elf_flagehdr.c + elf_flagelf.c + elf_flagphdr.c + elf_flagscn.c + elf_flagshdr.c + elf_getarhdr.c + elf_getaroff.c + elf_getarsym.c + elf_getbase.c + elf_getdata_rawchunk.c + elf_getdata.c + elf_getident.c + elf_getphdrnum.c + elf_getscn.c + elf_getshdrnum.c + elf_getshdrstrndx.c + elf_gnu_hash.c + elf_hash.c + elf_kind.c + elf_memory.c + elf_ndxscn.c + elf_newdata.c + elf_newscn.c + elf_next.c + elf_nextscn.c + elf_rand.c + elf_rawdata.c + elf_rawfile.c + elf_readall.c + elf_scnshndx.c + elf_strptr.c + elf_update.c + elf_version.c + elf32_checksum.c + elf32_fsize.c + elf32_getchdr.c + elf32_getehdr.c + elf32_getphdr.c + elf32_getshdr.c + elf32_newehdr.c + elf32_newphdr.c + elf32_offscn.c + elf32_updatefile.c + elf32_updatenull.c + elf32_xlatetof.c + elf32_xlatetom.c + elf64_checksum.c + elf64_fsize.c + elf64_getchdr.c + elf64_getehdr.c + elf64_getphdr.c + elf64_getshdr.c + elf64_newehdr.c + elf64_newphdr.c + elf64_offscn.c + elf64_updatefile.c + elf64_updatenull.c + elf64_xlatetof.c + elf64_xlatetom.c + gelf_checksum.c + gelf_fsize.c + gelf_getauxv.c + gelf_getchdr.c + gelf_getclass.c + gelf_getdyn.c + gelf_getehdr.c + gelf_getlib.c + gelf_getmove.c + gelf_getnote.c + gelf_getphdr.c + gelf_getrel.c + gelf_getrela.c + gelf_getshdr.c + gelf_getsym.c + gelf_getsyminfo.c + gelf_getsymshndx.c + gelf_getverdaux.c + gelf_getverdef.c + gelf_getvernaux.c + gelf_getverneed.c + gelf_getversym.c + gelf_newehdr.c + gelf_newphdr.c + gelf_offscn.c + gelf_update_auxv.c + gelf_update_dyn.c + gelf_update_ehdr.c + gelf_update_lib.c + gelf_update_move.c + gelf_update_phdr.c + gelf_update_rel.c + gelf_update_rela.c + gelf_update_shdr.c + gelf_update_sym.c + gelf_update_syminfo.c + gelf_update_symshndx.c + gelf_update_verdaux.c + gelf_update_verdef.c + gelf_update_vernaux.c + gelf_update_verneed.c + gelf_update_versym.c + gelf_xlate.c + gelf_xlatetof.c + gelf_xlatetom.c + libelf_crc32.c + libelf_next_prime.c + nlist.c +) +if(WIN32) + target_sources( + elf PRIVATE + ../lib/system_win32.c + ) +endif() +set(ELF_PUBLIC_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/gelf.h + ${CMAKE_CURRENT_SOURCE_DIR}/libelf.h + ${CMAKE_CURRENT_SOURCE_DIR}/nlist.h + ${CMAKE_CURRENT_SOURCE_DIR}/elf.h +) +set_target_properties( + elf PROPERTIES PUBLIC_HEADER + "${ELF_PUBLIC_HEADERS}" +) +target_include_directories( + elf PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/../lib + ${CMAKE_CURRENT_SOURCE_DIR}/ + ${CMAKE_CURRENT_SOURCE_DIR}/config-cmake +) +target_compile_definitions( + elf PRIVATE + -DHAVE_CONFIG_H +) +if (MSVC) + target_compile_definitions( + elf PRIVATE + -D_CRT_NONSTDC_NO_DEPRECATE + -D_CRT_SECURE_NO_WARNINGS + -D_CRT_SECURE_NO_WARNINGS_GLOBALS + ) +else() + target_compile_definitions( + elf PRIVATE + -D_FILE_OFFSET_BITS=64 + ) +endif() +set_property(TARGET elf PROPERTY C_STANDARD 11) + +if (MSVC) + # Enable find libz.a with msvc + set(CMAKE_FIND_LIBRARY_PREFIXES "" "lib") + set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".a") +endif() +find_package(ZLIB REQUIRED) +target_link_libraries(elf ZLIB::ZLIB) + +find_package(Intl) +if (TARGET Intl::Intl) + target_link_libraries(elf Intl::Intl) +else() + target_compile_definitions( + elf PRIVATE + -DNOT_HAVE_LIBINTL + ) +endif() diff --git a/libelf/config-cmake/config.h b/libelf/config-cmake/config.h new file mode 100644 index 00000000..25f1da57 --- /dev/null +++ b/libelf/config-cmake/config.h @@ -0,0 +1,27 @@ +#ifndef _CONFIG_H_ +#define _GNU_SOURCE +#include "eu-config.h" + +#if defined(_WIN32) +#define HAVE_DECL_MEMPCPY 0 +#define HAVE_DECL_MEMRCHR 0 +#define HAVE_DECL_POWEROF2 0 +#define HAVE_DECL_MMAP 0 +#else +#define HAVE_DECL_MEMPCPY 1 +#define HAVE_DECL_MEMRCHR 1 +#define HAVE_DECL_POWEROF2 1 +#define HAVE_DECL_MMAP 1 +#endif +#define HAVE_DECL_RAWMEMCHR 0 +#define HAVE_DECL_REALLOCARRAY 1 +#define HAVE_VISIBILITY 1 + +#undef HAVE_GCC_STRUCT +#undef USE_LOCKS + +#if !defined(_MSC_VER) +#define HAVE_ERROR_H +#endif + +#endif /* _CONFIG_H_ */ \ No newline at end of file