Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp613850pxb; Wed, 27 Jan 2021 16:49:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJxacUi6RPl8zeRHgKwfgFapXiXEbCtDdJHNuQxDH+09XrQBo0qxa+OR9hsXHV+lLsK+4n5S X-Received: by 2002:a17:907:6e6:: with SMTP id yh6mr8739423ejb.466.1611794951204; Wed, 27 Jan 2021 16:49:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611794951; cv=none; d=google.com; s=arc-20160816; b=Bt3pzYHHKqDOls9mGlzpTMowWjehC1a7aruTL18yD+bgGY3WVlQXm12SiIiSJg+XS8 UWHGHyC/5xTNJfroK6WzR+6kE7+laXM68c3pVSMIaH/18ChRAUlIOv/fjpjoLt3tTncL BbHFvuHIBENXl++cXVTz00a5Mnt0U1ZVaqtsZpHMFYOgRWWXmnN1F02VulHJE1W7Ibe2 rBOOWkvjO3iMjxDZSeATwGWc6W8QzEngej9qykLgl58ERSbY5vbA91Uoi8cNKlzb0e+t /kb0AyAqQFSuUts1CjGLvdpNQM0/asK7EIvZJRk8kvh9BpzoDu4GB8gXKtDiPMDjLFfr ji4A== 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=UmZtO9S6cUQ2CC3kIdExR5VZtUZQ7YeAA3zNA2d3Y68=; b=Uape2qyjC4ceKH9GxAlAXKQ0nSeYdRMOXGe+AVGvshsZHqk/EsT8F6RrCSaQeWgGnm EirNPKpKr1ZZ/cOd/O7AqAhyjQGxDoH3HlQSeh7WzNOFUv5x9ZwVKaSVu8cMHT9MSQN0 f/bJbDEZeqwowFhwnsj2lyIym0xA1PfLNOWX6opdg3AZY/GrXWrgoLGqEN8IHzB0UfOp siC3I/wVsuDEKhx34MMXLTQaRyeWPUxqvQLvFlBoGTLfDhLTEmsOOsluypQUr7PQGULx jB8Gg1g9I+vN9FMrcUDGYArZ/z/QutaRcegVv93Th+8NMC9bVha+ROrDkwLizqMD6/U9 JPnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="O8J/zUNB"; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hb10si1536717ejc.84.2021.01.27.16.48.47; Wed, 27 Jan 2021 16:49:11 -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=@redhat.com header.s=mimecast20190719 header.b="O8J/zUNB"; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232093AbhA0X3k (ORCPT + 99 others); Wed, 27 Jan 2021 18:29:40 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:22068 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233575AbhA0X21 (ORCPT ); Wed, 27 Jan 2021 18:28:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611790021; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UmZtO9S6cUQ2CC3kIdExR5VZtUZQ7YeAA3zNA2d3Y68=; b=O8J/zUNB/fjzK3kd4MdCE2T3SVeWcCiOE8HQtkuVJYZzlAwAFNOw3wbrnlNlPYBk7yB/97 kxr3UndrflIJSDiIa8+2CtG22dWzUGrMgJCtmwxinRuMtgitFNTe9RqZ/PnsTwAuM8aUcY iB3QZj2ONRrZnQpXm+HWM6PTL98RjzE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-508-yX2crCwSMlywEzTRrvJlVw-1; Wed, 27 Jan 2021 18:27:00 -0500 X-MC-Unique: yX2crCwSMlywEzTRrvJlVw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 25DAC911E3; Wed, 27 Jan 2021 23:26:57 +0000 (UTC) Received: from treble (ovpn-120-118.rdu2.redhat.com [10.10.120.118]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6681D10016FA; Wed, 27 Jan 2021 23:26:53 +0000 (UTC) Date: Wed, 27 Jan 2021 17:26:51 -0600 From: Josh Poimboeuf To: Nick Desaulniers Cc: jthierry@redhat.com, ardb@kernel.org, broonie@kernel.org, catalin.marinas@arm.com, keescook@chromium.org, linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org, linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, mark.rutland@arm.com, masahiroy@kernel.org, michal.lkml@markovi.net, peterz@infradead.org, raphael.gault@arm.com, will@kernel.org, clang-built-linux@googlegroups.com Subject: Re: [RFC PATCH 12/17] gcc-plugins: objtool: Add plugin to detect switch table on arm64 Message-ID: <20210127232651.rj3mo7c2oqh4ytsr@treble> References: <20210120173800.1660730-13-jthierry@redhat.com> <20210127221557.1119744-1-ndesaulniers@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210127221557.1119744-1-ndesaulniers@google.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 27, 2021 at 02:15:57PM -0800, Nick Desaulniers wrote: > > From: Raphael Gault > > > > This plugins comes into play before the final 2 RTL passes of GCC and > > detects switch-tables that are to be outputed in the ELF and writes > > information in an ".discard.switch_table_info" section which will be > > used by objtool. > > > > Signed-off-by: Raphael Gault > > [J.T.: Change section name to store switch table information, > > Make plugin Kconfig be selected rather than opt-in by user, > > Add a relocation in the switch_table_info that points to > > the jump operation itself] > > Signed-off-by: Julien Thierry > > Rather than tightly couple this feature to a particular toolchain via > plugin, it might be nice to consider what features could be spec'ed out > for toolchains to implement (perhaps via a -f flag). The problem is being able to detect switch statement jump table vectors. For a given indirect branch (due to a switch statement), what are all the corresponding jump targets? We would need the compiler to annotate that information somehow. > Distributions (like Android, CrOS) wont be able to use such a feature as > is. Would a Clang plugin be out of the question? -- Josh