From patchwork Tue Sep 20 08:43: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: 55129 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 A9B1C38582B2 for ; Tue, 20 Sep 2022 08:43:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A9B1C38582B2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663663417; bh=GftHP3Z8mvZbWWN0VVEBmiCQup8AZkiVTiCPY+9CeWE=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:From; b=p3vkA/HZG7TfwwADv4YlEWnW9z1TAX8g3qFV+pXF4bqBjjazS/mEiqBsJc/fuHN+z hLuB5fHabR+4u4fpA9eIBznnPHAvgzgM3OFcWSti3t9XWd8n3Yjql7VPLuYcDCt/6l h7DEDZlId398P3YEkTGCw0YlO3+pPob7h+rUHB4Y= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id 0911D3858D39 for ; Tue, 20 Sep 2022 08:43:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0911D3858D39 Received: by mail-pf1-x42b.google.com with SMTP id a80so2093096pfa.4 for ; Tue, 20 Sep 2022 01:43:22 -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; bh=GftHP3Z8mvZbWWN0VVEBmiCQup8AZkiVTiCPY+9CeWE=; b=ix6ZAuF6ew3uhzqyqotmW4WLZxl+pA8xbj+4qeLOCOTUlWwKBV/4RRc7u6DQQpFLGm gb+DH8Fw5dZ6GWr6gBBNiMw0Bk+hARQnsjWHSTEB9pFKtpr2Yt77EvfzjBkUW6fx3WNS omivIcs3t8thZQ2eH7M1khNRah0qhy9dBc+jvImgZgyMu6ZcH803VzvSyaEzjg2c5ze6 fQx9E/mTLvtY55a8eeE2at2BtRP/wyczEfOWlSOQ03ptJCpyk7aIa4irKUUd0DOKO0PD 4XkuLfp5CY4M5rQdckCAa0ORguKe4NSWMysUTwLsxXVwGUw87cCjUHQHoYqWgL8mQsyI pCEA== X-Gm-Message-State: ACrzQf0CqeViRPZAzZNkrSuIsQT4HynAFWsAFNrAIvCcWRYQjqRbo8T1 3A3en0GPeAv22uDz/m51ZzQarpm584Y= X-Google-Smtp-Source: AMsMyM4CVD2SjhgqGpkERWZYUcIWsvJEzFXb5UT4cXBaFk5xb3QVPhSd9wieO+xDc91DePhd8iPOTg== X-Received: by 2002:a63:5f8a:0:b0:43a:107f:4839 with SMTP id t132-20020a635f8a000000b0043a107f4839mr8754390pgb.376.1663663401819; Tue, 20 Sep 2022 01:43:21 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 01:43:21 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 0/7] Enable building libelf of elfutils on win32 Date: Tue, 20 Sep 2022 16:43:00 +0800 Message-Id: <20220920084307.1696-1-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 MIME-Version: 1.0 X-Spam-Status: No, score=-3.8 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 Yonggang Luo (7): Rename 'hello2.spec.' -> 'hello2.spec' 'hello3.spec.' -> 'hello3.spec' move platform depended include into system.h lib: Use NOT_HAVE_LIBINTL to guard if need #include Remove duplicated #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/eblmachineflagname.c | 1 - libebl/eblobjnotetypename.c | 2 - libebl/eblopenbackend.c | 1 - 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 74 files changed, 612 insertions(+), 166 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%)