Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1802971pxj; Sat, 5 Jun 2021 03:40:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwS/Gr9X5O5CnhdvdIa7W0Pdp/tB0srZ5hbWp4dZmSNArYEAPbYxdkskyCP7OVb/UnOWrJY X-Received: by 2002:a17:907:1112:: with SMTP id qu18mr8353867ejb.511.1622889632935; Sat, 05 Jun 2021 03:40:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622889632; cv=none; d=google.com; s=arc-20160816; b=arPzHqEXzNDNWRQh224BpgBRPXNubQlqzh+P6cHr7tDuh8RvC1759EKo3Ke0ZXlyhG cFh/dQbn/OPlrEahglNzcfsEhEuuKoSOkrO9zFzm5A+O4/iDG13xrMhRgWYsqu/WVPwH 3odLLhTSDjS7RRwD1/HSa+47CVUBoGXMZmJXai6l0X6DESYO21gDWLmc4F4tGY6gKpcb WDykn7LT6ylhW8L9NI0JLBRfndXSIyiS4AfkMHbYOKrrD3Cw3rz9mNTjMfswOd0LpRWy 8xtKziRXBX+mV9V39UnCaA8xi62HNC6y35/VwdT1+nezgFapGbF6orG8Nld2ZmkQebEg fdxw== 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=O6C1Dmxriqyn/gQ4Qn4heBEyEwp43YQhQLI8PrkD0ms=; b=tMb4m/qaiYh5nG7h9nc90EdiKwJ2oFT13J21HIoz8mN2md83jER1io4D7LaW/1oxQ4 B6vLo2ZiQBUR4ZtXRwhPeY6OGp+PcCWxIc2NnLL1ufIQ8+vUOs+EkVXdi4CD0FJ7nUWy UvlkmmYsIKBeOhwMXbbU2mcuh4/fveq2CdWv+JmMqaP8cP9IH1f2z1I9f6oIA2MvPOsd xcxip/pj4cbvCtcFXAey+vvStbbJ3CjjF+lRgmHJhNFDkYKLnaDKGl4LnoawJHZHKSvV 2GUd1OFymYGXlFnuv5eamdrDTxMdEX+osDYOt+Xa0ggtHCnU3+CTIjt371PZPauZmkC9 rjBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=ukIzKO2q; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v5si6724397edj.446.2021.06.05.03.40.10; Sat, 05 Jun 2021 03:40:32 -0700 (PDT) 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=@infradead.org header.s=casper.20170209 header.b=ukIzKO2q; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230084AbhFEKlD (ORCPT + 99 others); Sat, 5 Jun 2021 06:41:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229892AbhFEKlC (ORCPT ); Sat, 5 Jun 2021 06:41:02 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14A9AC061766 for ; Sat, 5 Jun 2021 03:39:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=O6C1Dmxriqyn/gQ4Qn4heBEyEwp43YQhQLI8PrkD0ms=; b=ukIzKO2qVLmkl/NFZYhV+MOrTh HIVhSFPZkApiUcFk5wHytCHeB+SuKzOvjKboXfYDqkKkj7Oq9YP10eGm0mUIzaxJJ5sMH0VaFZXWq XO3LFeWdQmgAyClqJhzX4gyJW+iDwf2PvNNMpnqPzrqsiOq3vKixOk6zmiS9orlUQ0Xz6NPF5SPMJ dOhyP4ePt7+BwLFGV8lE4KmgcgwCj6xmU7Vc15XUKZkCsYxPq5XZsm2A0imPJdd1Skaq1VPs8qdeD QLNmsgICCXS75P64uK7VyLn9C17CQfD+z5HU5rDL1i0YCQWUZrJNq9pmoCtRkmVQHq8ENCDZ0cTQ8 p9GQOsKQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lpThe-00E1tM-Tb; Sat, 05 Jun 2021 10:38:56 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id E231E300091; Sat, 5 Jun 2021 12:38:51 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id BD59A2CEABC01; Sat, 5 Jun 2021 12:38:51 +0200 (CEST) Date: Sat, 5 Jun 2021 12:38:51 +0200 From: Peter Zijlstra To: Fangrui Song Cc: Nick Desaulniers , Josh Poimboeuf , lma@semihalf.com, Guenter Roeck , Juergen Gross , lb@semihalf.com, LKML , mbenes@suse.com, rad@semihalf.com, upstream@semihalf.com, "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , clang-built-linux , Nathan Chancellor , Sami Tolvanen Subject: Re: [PATCH v3 16/16] objtool,x86: Rewrite retpoline thunk calls Message-ID: References: <20210604205018.2238778-1-ndesaulniers@google.com> <20210604235046.w3hazgcpsg4oefex@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210604235046.w3hazgcpsg4oefex@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 04, 2021 at 04:50:46PM -0700, Fangrui Song wrote: > On 2021-06-04, 'Nick Desaulniers' via Clang Built Linux wrote: > > is producing the linker error: > > > > ld.lld: error: drivers/gpu/drm/amd/amdgpu/amdgpu.lto.o: > > SHT_SYMTAB_SHNDX has 79581 entries, but the symbol table associated > > has 79582 > > > > Readelf having issues with the output: > > $ readelf -s amdgpu.lto.o.orig > > > > $ readelf -s amdgpu.lto.o > > readelf: Error: Reading 73014451695 bytes extends past end of file for > > string table > > $ llvm-readelf -s amdgpu.lto.o > > llvm-readelf: error: 'amdgpu.lto.o': unable to continue dumping, the > > file is corrupt: section table goes past the end of file > > > tools/objtool/elf.c:elf_add_symbol may not update .symtab_shndx . > Speaking of llvm-objcopy, it finalizes the content of .symtab_shndx when .symtab > is finalized. objtool may want to adopt a similar approach. > > read_symbols searches for the section ".symtab_shndx". It'd be better to > use the section type SHT_SYMTAB_SHNDX. I think you've absolutely nailed it; but would you have more information or a code reference to what you're speaking about? My complete ELF and libelf knowledge is very limited and as demonstrated here, I'm not at all sure how all that extended index stuff is supposed to work.