From patchwork Wed Jun 23 09:53:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1496017 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=adacore-com.20150623.gappssmtp.com header.i=@adacore-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=VNVeonZU; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G8zBG5q6Kz9sWc for ; Wed, 23 Jun 2021 19:54:13 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CAB11398302C for ; Wed, 23 Jun 2021 09:54:10 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id 6654D3857835 for ; Wed, 23 Jun 2021 09:53:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6654D3857835 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wr1-x42e.google.com with SMTP id a11so1882915wrt.13 for ; Wed, 23 Jun 2021 02:53:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=PTzA6L3E64sCYYwrMRQJC6VCz1RNoVGw72rALr+yRfA=; b=VNVeonZUvGedhzxptSLnMRR/g96XsQB7JLaH94ldfHshDHUITBwM1ym6DHl/rE46i1 9t7XEqzsYrP/5gJ9G/DjsHdi5AYbVa4Hkn4SNAsD7svlpf93/2o27dkKDvXbP5lrm8Gj MRruvoG1U5AB+0bZdIuXH+mb9D9iWceHmqUce9l8ZpobR+YBEcQmROCKXCE8rEpVV4tW ADXLm9pqSX+6qqmle49rx08MFFGV7EeFfodwhpPtvuKC/AzmYdAwRRSicRN47EO5a+Fs d9jczAWipkikzt5m1AgKbUAmpfJLrTdCWIQuPQVWOfOPCoA0frSHUFFMB3mIdnO2pFrZ hXqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=PTzA6L3E64sCYYwrMRQJC6VCz1RNoVGw72rALr+yRfA=; b=cqh54pn2PDATMPzG1Ozjy9QCXTKNVJYJG+IqHUSxVIakUr4CDGzGVl6GZ20rjpD5kW BOjNRAdRKoUFlceVVxF1BJIjUsB/NIPXA9BkveS20EUIm8TqWH6km6Wa+joOWskxcu2v bBDoPhh7Hisu3dTv9TF64S0VhWjgZ5pkzxkbm8hq7OJZGQbUfVhKgRobPuD+HoIHynkv GgA/sw4m6ontUMyQBeeZ16etdC9et47v7hKCQAgS+n9MFPLUckDYHx447p48ZGAelyhM gZFZvULbV1KqL/yczAwzh1jMBztr8c8jmuq8bzcQNWM285sUmfV5EDqRePzQuSExoIOU a5Rw== X-Gm-Message-State: AOAM531Hqh8b92Ji6HshaZu5E3U6StCttvW40wigSN2UqNuxP8o8C7Il flw3CbZURXr1fRQj5UMyp72hXgiJmqO8/ZL6 X-Google-Smtp-Source: ABdhPJynpGDGADfr0vL0e4bLUZgpDsc6q2lBEGKp6dzzzpgeq+gm60dC0q0GXCB4mJ37leHjb+mAkA== X-Received: by 2002:adf:f40c:: with SMTP id g12mr10536461wro.20.1624442023311; Wed, 23 Jun 2021 02:53:43 -0700 (PDT) Received: from fomalhaut.localnet ([2a01:e0a:41b:84f0:cf71:f5e0:b050:bede]) by smtp.gmail.com with ESMTPSA id p11sm2493488wre.57.2021.06.23.02.53.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 02:53:42 -0700 (PDT) From: Eric Botcazou X-Google-Original-From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix --gdwarf-5 configure tests for Windows Date: Wed, 23 Jun 2021 11:53:31 +0200 Message-ID: <7966174.NyiUUSuA9g@fomalhaut> MIME-Version: 1.0 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" The issues are that 1) they use readelf instead of objdump and 2) they use ELF syntax in the assembly code. Tested on x86-64/Linux and x86[-64]/Windows, OK for mainline and 11 branch? 2021-06-23 Eric Botcazou * configure.ac (--gdwarf-5 option): Use objdump instead of readelf. (working --gdwarf-4/--gdwarf-5 for all sources): Likewise. (--gdwarf-4 not refusing generated .debug_line): Adjust for Windows. * configure: Regenerate. diff --git a/gcc/configure.ac b/gcc/configure.ac index 5f30f80833e..70089394429 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -5457,13 +5457,23 @@ if test x"$insn" != x; then gcc_GAS_CHECK_FEATURE([--gdwarf-5 option], gcc_cv_as_gdwarf_5_flag, [elf,2,36,0], [--gdwarf-5], [$insn], - [if test x$gcc_cv_readelf != x \ - && $gcc_cv_readelf -wi conftest.o 2>&1 \ + [if test x$gcc_cv_objdump != x \ + && $gcc_cv_objdump -Wi conftest.o 2>&1 \ | grep DW_TAG_compile_unit > /dev/null 2>&1; then gcc_cv_as_gdwarf_5_flag=yes; fi],[AC_DEFINE(HAVE_AS_GDWARF_5_DEBUG_FLAG, 1, [Define if your assembler supports the --gdwarf-5 option.])]) + case $target_os in + win32 | pe | cygwin* | mingw32*) + section_flags=\"dr\" + function_type=".def foo; .scl 2; .type 32; .endef" + function_size="";; + *) + section_flags=\"\",%progbits + function_type=".type foo, %function" + function_size=".size foo, .-foo";; + esac dwarf4_debug_info_size=0x46 dwarf4_high_pc_form=7 dwarf4_debug_aranges_size=0x2c @@ -5475,16 +5485,16 @@ if test x"$insn" != x; then .Ltext0: .p2align 4 .globl foo - .type foo, %function + $function_type foo: .LFB0: .LM1: $insn .LM2: .LFE0: - .size foo, .-foo + $function_size .Letext0: - .section .debug_info,\"\",%progbits + .section .debug_info,$section_flags .Ldebug_info0: .4byte $dwarf4_debug_info_size .2byte 0x4 @@ -5508,7 +5518,7 @@ foo: .byte 0x1 .byte 0x9c .byte 0 - .section .debug_abbrev,\"\",%progbits + .section .debug_abbrev,$section_flags .Ldebug_abbrev0: .byte 0x1 .byte 0x11 @@ -5551,7 +5561,7 @@ foo: .byte 0 .byte 0 .byte 0 - .section .debug_aranges,\"\",%progbits + .section .debug_aranges,$section_flags .4byte $dwarf4_debug_aranges_size .2byte 0x2 .4byte .Ldebug_info0 @@ -5563,7 +5573,7 @@ foo: .${dwarf4_addr_size}byte .Letext0-.Ltext0 .${dwarf4_addr_size}byte 0 .${dwarf4_addr_size}byte 0 - .section .debug_line,\"\",%progbits + .section .debug_line,$section_flags .Ldebug_line0: .4byte .LELT0-.LSLT0 .LSLT0: @@ -5617,7 +5627,7 @@ foo: .byte 0x1 .byte 0x1 .LELT0: - .section .debug_str,\"\",%progbits + .section .debug_str,$section_flags .ident \"GCC\" " dwarf4_success=no @@ -5673,10 +5683,10 @@ foo: conftest_s="\ .text .globl foo - .type foo, %function + $function_type foo: $insn - .size foo, .-foo + $function_size .file 1 \"foo.c\" " gcc_GAS_CHECK_FEATURE([working --gdwarf-4/--gdwarf-5 for all sources], @@ -5684,8 +5694,8 @@ foo: [--gdwarf-4], [$conftest_s], [changequote(,)dnl - if test x$gcc_cv_readelf != x \ - && $gcc_cv_readelf -w conftest.o 2>&1 \ + if test x$gcc_cv_objdump != x \ + && $gcc_cv_objdump -W conftest.o 2>&1 \ | grep conftest.s > /dev/null 2>&1; then gcc_cv_as_working_gdwarf_n_flag=no else