From patchwork Sat Oct 15 16:36:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 55221 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 9B5133858284 for ; Sat, 15 Oct 2022 16:36:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9B5133858284 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665851814; bh=WpoQUzjMYDml2vxngaor5wlb4LRpiI/moi6+rwSYndg=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:From; b=QtD7igbjOMF2PqCoulHEiesgZ5kEt3fT97sMKLTyIvFq6XgMvtMGt8bmW3LMLwb5g Pyg0H3CmPaa/sLwPDVYU2vvbY2RYmX6NW/QIpOsOvCZyA7bJIrOhsufSLCiXD7DlcX HbAV7LZwOK1rv8REy7CjvfYQwkssHvg5hNU9k4XY= 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 A54733858D1E for ; Sat, 15 Oct 2022 16:36:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A54733858D1E Received: by mail-pj1-x102e.google.com with SMTP id x1-20020a17090ab00100b001fda21bbc90so10589076pjq.3 for ; Sat, 15 Oct 2022 09:36:39 -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:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=WpoQUzjMYDml2vxngaor5wlb4LRpiI/moi6+rwSYndg=; b=rW9P/UpzXdzQZ+jTIVy1RQ8ZfAmX+rQPdNv818jRT8ZOoNUWWFJiQTFjXzSKkgwGYj L6KJTBL/OtpdAGvOALZhUR6nY9B4fsw66Mr968oY97FzM8+OXmIfVPQDGCv+srjb1M0/ zWGTGo7xZ4Rp/sh3qY+fkvAfqP0E/0tfYCv7v5VnugwoKQAgW3JQYKyGJuNopfZWQTQ0 LBoI7QkcJFgTzrrJX6JPf752ee/8cKTlgwwERDxVd42G1booi9ngW6ITA7OxZDE1PsUr v2SMuwLpF9MKwWkFeM7bVo40+VGdwJPX9EI6P1Z/redbgV8zdqhHjjoti23YkZo5U4Vv 41Cg== X-Gm-Message-State: ACrzQf2VYEFsGo1moPbQ2OqjEtkAb1TVkLKEaQtBsRi2Qd19j2hDnMYP KtpFztDRZdJ99ol8LVJhY8I90T89PWWPJA== X-Google-Smtp-Source: AMsMyM6iTKFnYC9VTsXvZZxorTFOBpTWTJoPdCDMzjKuy170UYYH6U5eftTJvtFy+1szUYT/PfA9eg== X-Received: by 2002:a17:90b:4a43:b0:20d:8948:1733 with SMTP id lb3-20020a17090b4a4300b0020d89481733mr22948709pjb.79.1665851798344; Sat, 15 Oct 2022 09:36:38 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id b5-20020a62a105000000b0056299fd2ba2sm3760622pff.162.2022.10.15.09.36.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Oct 2022 09:36:37 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH v2 0/7] Enable building libelf of elfutils on win32 Date: Sun, 16 Oct 2022 00:36:19 +0800 Message-Id: <20221015163622.129-1-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no 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" After these changes, now libelf can be build with mingw/gcc and msvc/clang v1 -> v2 Do no modify libebl in commit move platform depended include into system.h of libelf Add commit Move the #include into eu-config.h to Yonggang Luo (7): Rename 'hello2.spec.' -> 'hello2.spec' 'hello3.spec.' -> 'hello3.spec' move platform depended include into system.h of libelf Move the #include into eu-config.h lib: Use NOT_HAVE_LIBINTL to guard #include Strip __ prefix from __BYTE_ORDER __LITTLE_ENDIAN and __BIG_ENDIAN Fixes building with msvc/clang mingw/gcc Add CMake build files .gitignore | 1 + CMakeLists.txt | 47 +++++ configure.ac | 1 + debuginfod/debuginfod.cxx | 1 - lib/color.c | 1 - lib/eu-config.h | 8 + lib/printversion.c | 1 - lib/system.h | 74 ++++++- lib/system_win32.c | 162 +++++++++++++++ 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_disasm.c | 2 +- libcpu/i386_lex.l | 1 - libcpu/i386_parse.y | 1 - libcpu/memory-access.h | 26 +-- libcpu/riscv_disasm.c | 2 +- libdw/libdwP.h | 1 - libdw/memory-access.h | 8 +- libdwfl/argp-std.c | 1 - libdwfl/dwfl_error.c | 1 - libdwfl/dwfl_segment_report_module.c | 2 +- libebl/libeblP.h | 1 - libelf/CMakeLists.txt | 192 ++++++++++++++++++ libelf/common.h | 5 +- libelf/config-cmake/config.h | 27 +++ libelf/elf32_checksum.c | 5 +- libelf/elf32_getphdr.c | 2 - libelf/elf32_getshdr.c | 2 - libelf/elf32_updatefile.c | 6 +- libelf/elf32_updatenull.c | 2 - libelf/elf32_xlatetof.c | 5 +- libelf/elf32_xlatetom.c | 1 - libelf/elf_begin.c | 10 +- libelf/elf_cntl.c | 2 - libelf/elf_compress.c | 2 - libelf/elf_end.c | 3 +- libelf/elf_error.c | 1 - libelf/elf_getarsym.c | 10 +- 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 | 7 +- libelf/gelf_xlate.c | 1 - libelf/libelf.h | 6 + libelf/libelfP.h | 5 + libelf/nlist.c | 1 - lib/xasprintf.c => libelf/win32/ar.h | 104 +++++----- src/addr2line.c | 1 - src/ar.c | 1 - src/arlib-argp.c | 1 - src/arlib.c | 1 - src/arlib.h | 2 +- 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 - tests/Makefile.am | 2 +- .../{hello2.spec. => hello2.spec} | 0 .../{hello3.spec. => hello3.spec} | 0 71 files changed, 612 insertions(+), 162 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 lib/system_win32.c create mode 100644 libelf/CMakeLists.txt create mode 100644 libelf/config-cmake/config.h copy lib/xasprintf.c => libelf/win32/ar.h (66%) rename tests/debuginfod-rpms/{hello2.spec. => hello2.spec} (100%) rename tests/debuginfod-rpms/{hello3.spec. => hello3.spec} (100%)