Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp494603pxu; Tue, 1 Dec 2020 17:11:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJzuUSXgVju7SupJkij5NnIROcMnN1VJb0vUKaW2UsyciwdJ/yvIQqKv8TL+0ssLi17Sp7Mi X-Received: by 2002:a50:b205:: with SMTP id o5mr333992edd.304.1606871495685; Tue, 01 Dec 2020 17:11:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606871495; cv=none; d=google.com; s=arc-20160816; b=MaQigsGRN7DX7liz2u/mrdZjLvxc9LUI5QcSDG+cH3B6RGreHuGC2csPIsRJBfVxvw yW5pVRQLDMiXHazsaBtWUk7DPdNGCwgqwixNJjCX8NPH50FxmT4o5fbo8+Em78jYy5Pm AVeYOQn/vFjFIn/grgPrMSqW6SlVya9DShwO6bNXT2qlpaM5FfjL5jukgTfgiHMGrgsl fGtNbSBF4Nd8ttjSUUqDFUu6P9/WToCB7HxgIBwxnvxkj0PdIHIA/7STvymwZKLrX7Yz VOzUhDNeLfCkPcfQL0mgT+OqHrqO4qHsoGh4OW0dlhoGAUOV+Qqj1He5YLxNLDsfJWfH jX8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ltLpeaxsolQPncFM8sGYWmfl/tK1nPLTaUTVm/mA5BE=; b=TSfbpBvZyR3Keq+8rghCdDiwy7sJsiyNWAw+wJm9/EN0ujH4wcbtMs5XfPKKdeFSLA F3PYoY8Ehnvj0AKp9bjUFsCXMtzPBVPof9fPAoRSpExoP39yee9KMyaAR4TyCJWAhQEe jQfiPG0x80prQFaTEuPjV0Lfga0c23Lqm3MnuGzxSlRPDcKd4wjMCM+RNZ6yEyhNVE1X Rd5nQKiEwaQbu/LltYiqiGE5pyYG7SY5DHLAV/SVJae1vW8mmKlz0KGAgnaSBWYeA8BP zxkLfJ4KCqxt0q7I/MqYQKpyUU1t6QdQ+vUL6l8s3H0OLx4oeu/JF8n2MmT37NwcCHuG TzEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=wApgbcd8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ho39si1078976ejc.745.2020.12.01.17.11.13; Tue, 01 Dec 2020 17:11:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=wApgbcd8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727960AbgLBBJm (ORCPT + 99 others); Tue, 1 Dec 2020 20:09:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727676AbgLBBJm (ORCPT ); Tue, 1 Dec 2020 20:09:42 -0500 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 494EDC0613D6 for ; Tue, 1 Dec 2020 17:08:56 -0800 (PST) Received: by mail-pg1-x542.google.com with SMTP id s63so25699pgc.8 for ; Tue, 01 Dec 2020 17:08:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ltLpeaxsolQPncFM8sGYWmfl/tK1nPLTaUTVm/mA5BE=; b=wApgbcd8u6gO1J0ik8J/8fQ6zRw+KUw8p0JlvaE9zlEB0CkataSmoW3aHSRLcRoRN6 On9jYY7GBEN4j2uY36KIHuOP+HXHG4kzK7eL7tCamzOOITQ7M9CSbj3CCFQgx2mAjyMT akcayOY8U2YzrhI2zmI5MjAB2KeOxpPZ/H1w8ahGqbyFdwHNGwez8nMfy+KAI8xXwAg8 O7/b3lhmsq2m7cHdAI/sqThS6DA+MG/RgS868OmeAM4YSZMjUv/meNm6hfB8SXtElU0d inArEgjEg+RBbhuHHX+HNmGCATIAqq6M/MnM4ycH0KcWqgRyNkU+i70EpEoYGVgqU6He 0aSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ltLpeaxsolQPncFM8sGYWmfl/tK1nPLTaUTVm/mA5BE=; b=tbfBY9bDydCpayqqpAMQi2sqU7YCnd/Sk8k0olsDVu38svEfne3j1HCSvg9wwNi7pX L35oYQwslo4ZR8TqIy8g0U2fFVT4q8A5bqo0w97qRwyJ+ot6E1zYjOTLkVwgWaUjBIxw GnJGoVMoiVRvh3/Q/zTvgN14ezP/iGqV+ktCCX/G9mY3ZGPw8hHHhAYU0TIsZ+k1Wrt9 qVA+hc7d9r2kAR8I2IqLNUOaISt+tBHnX0wwWq9NqZZRSCMXounTJNlpV1Yubtzin67q pRHnLAGVUkQmNvctrlC3okbcfG0pkDeuFW6lzJyvPONqnrBY7d48tQuHp0flDl/tGXUM BiXA== X-Gm-Message-State: AOAM5307ntF+3L0COX0NyxdfXY5jM7dpDd2VZOp51Dq6l2N+lMBOZQiz 34AtFFy3uyYUqLO8JT1JTXQcqA== X-Received: by 2002:a63:a62:: with SMTP id z34mr302597pgk.193.1606871335639; Tue, 01 Dec 2020 17:08:55 -0800 (PST) Received: from google.com ([100.117.212.88]) by smtp.gmail.com with ESMTPSA id f17sm137871pfk.70.2020.12.01.17.08.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2020 17:08:54 -0800 (PST) Date: Tue, 1 Dec 2020 17:08:50 -0800 From: =?utf-8?B?RsSBbmctcnXDrCBTw7JuZw==?= To: Segher Boessenkool Cc: Masahiro Yamada , Nick Desaulniers , Jakub Jelinek , Linux Kbuild mailing list , Linux Kernel Mailing List , linux-toolchains@vger.kernel.org, clang-built-linux , Nathan Chancellor , Sedat Dilek , Dmitry Golovin , Alistair Delva Subject: Re: [PATCH v2 3/4] Kbuild: make DWARF version a choice Message-ID: <20201202010850.jibrjpyu6xgkff5p@google.com> References: <20201104005343.4192504-1-ndesaulniers@google.com> <20201104005343.4192504-4-ndesaulniers@google.com> <20201201093253.GJ2672@gate.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20201201093253.GJ2672@gate.crashing.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-12-01, Segher Boessenkool wrote: >On Tue, Dec 01, 2020 at 12:38:16PM +0900, Masahiro Yamada wrote: >> > We can bump -Wa,-gdwarf-2 to -Wa,-gdwarf-3 since GNU actually emits >> > DWARF v3 DW_AT_ranges (see >> > https://sourceware.org/bugzilla/show_bug.cgi?id=26850 ) >> > This can avoid the `warning: DWARF2 only supports one section per >> > compilation unit` warning for Clang. > >That warning should be "there can be only one section with executable >code per translation unit", or similar. > >> I am not a DWARF spec expert. > >Neither am I. > >> Please teach me. >> >> In my understanding, "DWARF2 only supports one section ..." >> is warned only when building .S files with LLVM_IAS=1 > >.S files are simply run through the C preprocessor first, and then given >to the assembler. The only difference there should be wrt debug info is >you could have some macros that expand to assembler debug statements. > >> If this is due to the limitation of DWARF v2, why is it OK to >> build .c files with LLVM_IAS? > >The compiler can of course make sure not to use certain constructs in >its generated assembler code, while the assembler will have to swallow >whatever the user wrote. > These are all correct. You can use `llvm-dwarfdump a.o` to dump a .o file. It has one DW_TAG_compile_unit. If the translation unit has a single contiguous address range, the assembler can emit a pair of DW_AT_low_pc/DW_AT_high_pc (available in DWARF v2). In the case of multiple executable sections, it is not guaranteed that in the final linked image the sections will be contiguous, so the assembler has to assume there may be non-contiguous address ranges and use DW_AT_ranges. Unfortunately DW_AT_ranges was introduced in DWARF v3 and technically not available in DWARF v2. But GNU as ignores this and emits DW_AT_ranges anyway (this is probably fine - like using a GNU extension). If -Wa,-gdwarf-2 -> -Wa,-gdwarf-3 can eliminate the LLVM integrated assembler's warning, we should do it. If people think -Wa,-gdwarf-2 is not useful and want to delete it, I'll be happier. Whether it is necessary to use -Wa,-gdwarf-2/-Wa,-gdwarf-5? Personally I would think this is unnecessary, but I won't mind if people don't mind the additional complexity in Makefile. (I implemented the -gdwarf-5 address range stuff for the integrated assembler).