From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id BCCA93971C13 for ; Thu, 1 Jul 2021 20:12:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BCCA93971C13 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625170359; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TL4v5CGFK3p5vY+vnApDAmHJO3WLWW1b6/kXJ7HrhB8=; b=LgWwCxNcNIRSEc4iY2YACL7E25EtP7mLstezNZomQeNET84rF4UuaxiiAdLsjw0CvPx7cx frxZVkv+4+CDP3pVmfJ11WPzO1qGXRdHM5dLqetye4f/FhxKT5G0ImC//CBpc44i1+Ninw +l66+eIThFgIxKwK4cJNvjp4D0vBrZM= Received: from mail-ot1-f70.google.com (mail-ot1-f70.google.com [209.85.210.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-334-iikJgOx9Mz2lfkK5xxowWg-1; Thu, 01 Jul 2021 16:12:38 -0400 X-MC-Unique: iikJgOx9Mz2lfkK5xxowWg-1 Received: by mail-ot1-f70.google.com with SMTP id z60-20020a9d24c20000b029045ef35e4636so4766637ota.2 for ; Thu, 01 Jul 2021 13:12:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=TL4v5CGFK3p5vY+vnApDAmHJO3WLWW1b6/kXJ7HrhB8=; b=irVe+HEXFnt5NHlIAQxrJqzzgWgvmbAKUrv1hh+JiyYaV8Xa4zkEYrFyZiTM9ufOJz 4u72A4LlRnciBYw/91LQCfNPX7xaJLozSbidWJ6tWesF46oAyZOKiMtrxGy64qnSMDG9 OOctEXpXcS3LZ92jRrbSIBziChC3eo6dT1hv1rZODjlb0xNIeh//Ljow3r+Gnh483HzI 2lpzat0a4wI5p2+b46MY5rFdPvhv22otx4MuwrtAXHTp7qv+3JTkKCuwAb+yXmi5yAV5 XSJkIy74jSL/EpPJOPkH1rhogkNkENgAJPLScipkQjYRPQIIGhGbItMa1fpNSvMdV6WV kKzg== X-Gm-Message-State: AOAM5327UpCMzwwEDoBfLI+nhd1lKBJMjwb+cH6jjGYasdfBkriwD6wi kNT783meFBaMNBkabG1yU4bdz7byriWE7dZezRuIO7k+yBu64Fi0pQXJ6teArjXurqj8PVubemZ xSzh6kFZB+8nZiILAa2gB51QtMcO2PLSkBmqCfOfRQl75DhWQc0CibNICIh9ZvfpbqBHcCDE= X-Received: by 2002:aca:360b:: with SMTP id d11mr9187820oia.108.1625170357629; Thu, 01 Jul 2021 13:12:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6myKbBJugiwYzwy5Q4d9Lipq0PKezKSNFy+Of9esDh8MqnwdwzxNH1QcBGmDfCf9NNSYp9w== X-Received: by 2002:aca:360b:: with SMTP id d11mr9187802oia.108.1625170357430; Thu, 01 Jul 2021 13:12:37 -0700 (PDT) Received: from tstellar.remote.csb (97-120-209-236.ptld.qwest.net. [97.120.209.236]) by smtp.gmail.com with ESMTPSA id n1sm153548ooj.42.2021.07.01.13.12.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 01 Jul 2021 13:12:36 -0700 (PDT) Subject: Re: [PATCH] debugedit: Skip relocations with missing symbol/section offset. To: Mark Wielaard , debugedit@sourceware.org References: <20210701100519.321801-1-mark@klomp.org> From: Tom Stellard Message-ID: <48d48fc3-0875-04f9-63f3-1e565335d540@redhat.com> Date: Thu, 1 Jul 2021 13:12:35 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <20210701100519.321801-1-mark@klomp.org> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=tstellar@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: debugedit@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: debugedit development mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2021 20:12:41 -0000 On 7/1/21 3:05 AM, Mark Wielaard wrote: > We tried to handle relocations that didn't have a symbol associated > with any section. The would cause a message like: "Unhandled > relocation 1 in .debug_info section". Which wasn't that helpful > either. So skip relocations without an associated symbol section index > and improve the error message a little. > > * debugedit.c (setup_relbuf): Continue when sym.st_shndx == 0. > Add relocation index to error message. > I tested this and can confirm that it fixes my issue with the Fedora kernel builds with clang and LTO. -Tom > Signed-off-by: Mark Wielaard > --- > tools/debugedit.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > > diff --git a/tools/debugedit.c b/tools/debugedit.c > index c6975b2..d0c6371 100644 > --- a/tools/debugedit.c > +++ b/tools/debugedit.c > @@ -561,10 +561,11 @@ setup_relbuf (DSO *dso, debug_section *sec, int *reltype) > continue; > /* Only consider relocations against .debug_str, .debug_line, > .debug_line_str, and .debug_abbrev. */ > - if (sym.st_shndx != debug_sections[DEBUG_STR].sec > - && sym.st_shndx != debug_sections[DEBUG_LINE].sec > - && sym.st_shndx != debug_sections[DEBUG_LINE_STR].sec > - && sym.st_shndx != debug_sections[DEBUG_ABBREV].sec) > + if (sym.st_shndx == 0 || > + (sym.st_shndx != debug_sections[DEBUG_STR].sec > + && sym.st_shndx != debug_sections[DEBUG_LINE].sec > + && sym.st_shndx != debug_sections[DEBUG_LINE_STR].sec > + && sym.st_shndx != debug_sections[DEBUG_ABBREV].sec)) > continue; > rela.r_addend += sym.st_value; > rtype = ELF64_R_TYPE (rela.r_info); > @@ -625,8 +626,8 @@ setup_relbuf (DSO *dso, debug_section *sec, int *reltype) > #endif > default: > fail: > - error (1, 0, "%s: Unhandled relocation %d in %s section", > - dso->filename, rtype, sec->name); > + error (1, 0, "%s: Unhandled relocation %d at [%d] for %s section", > + dso->filename, rtype, ndx, sec->name); > } > relend->ptr = sec->data > + (rela.r_offset - base); >