From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 5F25E3858039 for ; Sun, 17 Jan 2021 19:26:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5F25E3858039 Received: by mail-ot1-x335.google.com with SMTP id i30so1296598ota.6 for ; Sun, 17 Jan 2021 11:26:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=n/gGXpO/eAufm/VW0cb/bEcqOz8M+toKOVlSzwDitBo=; b=hZf0NhTbzdfg0WoYJvs8SU0XTFOufZp5XvDhcm+OY6ooCt71Y1OwyGlwtEEIdMSA5v JK9hFyxmrrDCypazrgjalmU6JjpibjkzVChEYa2eKPq5jBj9V4e/fdhxKBzMmM7fh4uX WCxCd7yhlcXzC+yR5Y42SBn5J08CZpfs2YkO95j2j3M4B7OcJbhgU1AD35rg8MdoVNPR 23ylz2sOxIH1bQ5Dqcc13aY9mWmorT2Jo7x0AbN1ucdSMNfQf/g4wrzju5d1chf3275D 6vlQWmPl9cQkfyBeM3H4EzEqEJjdozrcGTJM5HfF2719uYNQiTVDF6K9BaD2mAlyFrpF c7bw== X-Gm-Message-State: AOAM532gTtK+PhCgj8+twCRqD9iTucDy6R56rUyENXNM0+MbnZbscGAO 7t50cC6gsrpGIYZ1k2WrjAqhzVKaJ0ea5O/YBO6GLAnRmxk= X-Google-Smtp-Source: ABdhPJzKw0dI7FvRdnJAvBTy0HiFsUe4psYwv8zjRhyuA8hDc+rIcoasPMCsX/s03HMjCYa6e6lV+C5HxKjkFCwmW+Y= X-Received: by 2002:a05:6830:1d71:: with SMTP id l17mr15260308oti.269.1610911606710; Sun, 17 Jan 2021 11:26:46 -0800 (PST) MIME-Version: 1.0 References: <20210117044819.1994000-1-hjl.tools@gmail.com> <20210117061153.kbel4vsbblm7sdvx@gmail.com> <20210117185605.gtwjb2imxaepslkp@gmail.com> In-Reply-To: <20210117185605.gtwjb2imxaepslkp@gmail.com> From: "H.J. Lu" Date: Sun, 17 Jan 2021 11:26:10 -0800 Message-ID: Subject: Re: [PATCH] as: Automatically enable DWARF5 support To: Fangrui Song Cc: Mark Wielaard , Binutils Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3030.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jan 2021 19:26:48 -0000 On Sun, Jan 17, 2021 at 10:56 AM Fangrui Song wrote: > > On 2021-01-17, H.J. Lu wrote: > >On Sat, Jan 16, 2021 at 10:11 PM Fangrui Song wrote: > >> > >> On 2021-01-16, H.J. Lu via Binutils wrote: > >> >Currently > >> > > >> >$ as -o x.o x.s > >> > > >> >fails when x.s contains DWARF5 info. Add a .dwarf_level directive to > >> >set the DWARF level and GCC can emit ".dwarf_level 5" when generating > >> >DWARF5 info so that > >> > > >> >$ gcc -S -g -c x.c > >> >$ gcc -c x.s > >> > > >> >works. > >> > >> The problem is file number 0 in .file and .loc directives. An alternative > >> design is to detect number 0 and upgrade to DWARF v5 line tables automatically. > >> > >> If we decide to add a new directive, .dwarf_version is better than .dwarf_level . > >> The DWARF specifications don't use the term "level". > > > >How about this patch to automatically enable DWARF5 support? > > > >-- > >H.J. > > Thanks! I created a patch for LLVM integrated assembler: > https://reviews.llvm.org/D94882 to bring attention to debug info folks. > > > Some nitpicks: > > > "fails when x.s contains DWARF5 info." > > This can be elaborated: it is .file 0 or .loc 0. Like --- Currently $ as -o x.o x.s fails when x.s contains DWARF5 ".file 0" or ".loc 0" directives. Update assembler to automatically enable DWARF5 support so that $ gcc -S -g -c x.c $ gcc -c x.s works. --- > as -gdwarf-4 x.s upon .file 0 probably deserves a test. On LLVM side, making I updated the patch to test -gdwarf-3 with ".file 0" in https://gitlab.com/x86-binutils/binutils-gdb/-/commit/a1da4f25964b54317071fd27fd9121c187f2a79a Since readelf doesn't support ".loc 0", I have a followup patch: https://gitlab.com/x86-binutils/binutils-gdb/-/commit/edde4bf8d2c35d94a0567e8bd3c5d3d4b1233010 > it error requires additional complexity so I am going to ignore the diagnostic. > It is perfectly fine for as to error if it does not add much complexity. -- H.J.