From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) by sourceware.org (Postfix) with ESMTPS id AAB083840C2F; Wed, 3 Jun 2020 21:51:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AAB083840C2F Received: by mail-il1-x142.google.com with SMTP id z2so4116481ilq.0; Wed, 03 Jun 2020 14:51:00 -0700 (PDT) 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=g/eWRV2DyJdkqoP/h7oI3Ke8YtMRGE5MI3E7YEgLzI8=; b=ZbdAoeUOhDfZmf0HygwlcTXlH/rssuUzSmW/r4ScBOsN4bxixUVv7fkuWRdXztd1E8 HM2/WqpV3XQyKoRP59iMmeKrOLDC5FDs7f9nvlmlMeBmOCY6KYYVEhPw5KIFw9Q67sU0 hxlorV77mOzTUoHUKw8uAlfQN/rg2oNYOPVSL29Yn3QJ3Ca1qgNZ3X264QoTtvHxLmsI jgPxQ+F0bDZI60XR9LBA5VWoF3BSHdfGoLjQhr13nUtggIfVyPE7LFlUQ/Xq2hrEKuiE CzJ8bhMax6HeqSALKlGpOIKLUfj4B/AcBPlmR5ZLgi1EQDtknQNx/EN48+hiwiEW8iRF 97Ig== X-Gm-Message-State: AOAM531gc93P7Yi1LEneGo0WyLnOd+mzpL3RBuvziMFGLs6NT/WR4t94 TElVnyPAfpHTT9aBdvGWcDik9jwNYcPozebpAbI= X-Google-Smtp-Source: ABdhPJyW7j4cen72Og0CG1KvriP/yy995lMccq9qOSzNSNatdhMoUgHb80Yw6WjZxonGxD9Tt1ODedqGMVoAPx1Qzwc= X-Received: by 2002:a92:4810:: with SMTP id v16mr1487421ila.75.1591221060210; Wed, 03 Jun 2020 14:51:00 -0700 (PDT) MIME-Version: 1.0 References: <20200531185506.mp2idyczc4thye4h@google.com> <20200531201016.GJ44629@wildebeest.org> <20200531222937.GM44629@wildebeest.org> <20200601093103.GN44629@wildebeest.org> <20200603031040.GD29024@bubble.grove.modra.org> In-Reply-To: <20200603031040.GD29024@bubble.grove.modra.org> From: David Blaikie Date: Wed, 3 Jun 2020 14:50:49 -0700 Message-ID: Subject: Re: Range lists, zero-length functions, linker gc To: Alan Modra Cc: Mark Wielaard , gdb@sourceware.org, elfutils-devel@sourceware.org, binutils@sourceware.org, Fangrui Song Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.9 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: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Jun 2020 21:51:01 -0000 On Tue, Jun 2, 2020 at 8:10 PM Alan Modra wrote: > > On Tue, Jun 02, 2020 at 11:06:10AM -0700, David Blaikie via Binutils wrote: > > On Tue, Jun 2, 2020 at 9:50 AM Mark Wielaard wrote: > > > where I > > > would argue the compiler simply needs to make sure that if it generates > > > code in separate sections it also should create the DWARF separate > > > section (groups). > > > > I don't think that's practical - the overhead, I believe, is too high. > > Headers for each section contribution (ELF headers but DWARF headers > > moreso - having a separate .debug_addr, .debug_line, etc section for > > each function would be very expensive) would make for very large > > object files. > > With a little linker magic I don't see the neccesity of duplicating > the DWARF headers. Taking .debug_line as an example, a compiler could > emit the header, opcode, directory and file tables to a .debug_line > section with line statements for function foo emitted to > .debug_line.foo and for bar to .debug_line.bar, trusting that the > linker will combine these sections in order to create an output > .debug_line section. If foo code is excluded then .debug_line.foo > info will also be dropped if section groups are used. I don't think this would apply to debug_addr - where the entries are referenced from elsewhere via index, or debug_rnglist where the rnglist header (or the debug_info directly) contains offsets into this section, so taking chunks out would break those offsets. (or to the file/directory name part of debug_line - where you might want to remove file/line entries that were eliminated as dead code - but that'd throw off the indexes)