Received: by 10.213.65.68 with SMTP id h4csp515742imn; Tue, 13 Mar 2018 11:30:16 -0700 (PDT) X-Google-Smtp-Source: AG47ELs/ZRPQ3lMLOVlMqaIuZnAMtRmu78f4UCD4NPrd3Lvbuxtpq5be8Z6Z+I9MT2iM6r2PGoeG X-Received: by 10.101.76.204 with SMTP id n12mr1256174pgt.249.1520965816288; Tue, 13 Mar 2018 11:30:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520965816; cv=none; d=google.com; s=arc-20160816; b=xLDzLFng49Nz1aOZ+X0lCP4Er2l6xuClwwkxjzgWEpeWzbELmj/MjFZs+dTrnyFjxQ JUdeGTzai07I+oiU0WKZan8eQfzEsneiN3krgTrOwUJkqD+mWwDlVYKOPbeQvOpwYA1m tiMDx8jR5M3QOSsVvPiS6kefe/lr8YfIRqQ2yyIKkKmD2KVgLDibf/H5B9n8KIzYyJIM 9lxnT3sFIqg0j9hDxNA63LhFI8gzmu7Gdg05NoRIkrN4fwRXIg+dJ/oELDp0NfmAkYkd YruQeYDajuIDhNCQXHDl+rASRvXklVt7rS9E8MvABA73JIs7ppaAnAyX1kVEzEKCGLR2 s5tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=QaGrIosurh4LkW6tMbJuBfmJt9LdmCln25ou93WhYGM=; b=QpN3DCh2awhKU6qKnDcvo1QS2zMiu7kX6UCYuNVBDxd0/qOkBlkxju1+ZT1J7c1Oc/ SDkUrWvsskyUkjLrsifKpRXrwqJgnOwWqhF/yhgMIgjXPVnbmHPZUmg46uNt0gqy7sci DiWmQ5C2KPyNcEjjm//k8VugYYcJ6HUf0GRJX3kMKVZjHxrbjdH11STTe6Fvh9SyMhiX kC08LzLScojXcUuz7rCSuVPhw106XyeQGqwhF6zM3y9xYhUdJ7SNbmEaeR6148zIJ18F GZ6iaLj9hIefO4coh5e1bi/fcgOVk6ZLDBIqJxeFSUNADNG1D1PhQFF0N69igWQG1uFQ 0WLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WbnN46yX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k1si441811pgc.638.2018.03.13.11.30.01; Tue, 13 Mar 2018 11:30:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WbnN46yX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752515AbeCMS3F (ORCPT + 99 others); Tue, 13 Mar 2018 14:29:05 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:43163 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752196AbeCMS3C (ORCPT ); Tue, 13 Mar 2018 14:29:02 -0400 Received: by mail-io0-f194.google.com with SMTP id l12so1232904ioc.10 for ; Tue, 13 Mar 2018 11:29:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=QaGrIosurh4LkW6tMbJuBfmJt9LdmCln25ou93WhYGM=; b=WbnN46yXp4ckWK5JJxGpaFBbxOWEiVY/i3quRBf1AiToQuJl2ShE25AKeWsFiiboSM qRszqTA9267hwaZ3EWZ2DNhnOam1pw7MctFSc8iD3qa3/vC6zVTrIo4gvrl7gEg+/4lY JNbvmwJSo4WmXX38vmLl1crekG4hHp0B17D8g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=QaGrIosurh4LkW6tMbJuBfmJt9LdmCln25ou93WhYGM=; b=LcyeNT4dbF4K8hekTdxTJ1UivQP8PSqIXP5ltLFXzpWxvezXU9avia1R8HPhyphEVj GuiuYZ5H+rIbhFONxsJ6gdoZa65J8s4UDP9USFnBqqc8fykhJMdfK+lNEW0ICxpvElvv 0pW+iqb/6Em9rV/IcnVxjcnfhT9tSeYSk9uVPQtGAEhlGEeNAvKVGhmsS6BDAt3TsCFw FZQubzCHwnhEVjjHVuQa4TZBhfVke24Cleq03z1ke8bZHpgo/IRtsmZR8pUlYP3f+hrz OlzNGenPeY/AYNLGO0Bah5zdMB8q1unnXMLbH9ncX8YoWwR+yfVby4QvDyT7fU2nxyQG 28Rg== X-Gm-Message-State: AElRT7GN0R0tUoGUCdrjg5UQ098dhBDNt9uFxHmv1ESADZz5vLGqKisb PrzVvMgrdS358lsQe8VtM/aF/Mj94inL+i+QPmM5iw== X-Received: by 10.107.5.199 with SMTP id 190mr1910206iof.107.1520965741484; Tue, 13 Mar 2018 11:29:01 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.138.209 with HTTP; Tue, 13 Mar 2018 11:29:01 -0700 (PDT) In-Reply-To: References: <20180313135314.18780-1-alexander.sverdlin@nokia.com> <20180313135314.18780-3-alexander.sverdlin@nokia.com> <5d3ae760-45bd-3588-500f-1b352e1722de@nokia.com> <60156300-b74a-628c-d296-7fb71a0eeb4f@nokia.com> From: Ard Biesheuvel Date: Tue, 13 Mar 2018 18:29:01 +0000 Message-ID: Subject: Re: [PATCH v4 2/2] ARM: ftrace: Add MODULE_PLTS support To: Alexander Sverdlin Cc: linux-arm-kernel , Linux Kernel Mailing List , Russell King , Steven Rostedt , Ingo Molnar Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13 March 2018 at 18:24, Alexander Sverdlin wrote: > Hi! > > On 13/03/18 18:51, Ard Biesheuvel wrote: >>>> if (IS_ENABLED(CONFIG_ARM_MODULE_PLTS)) >>>> module_plt_alloc_fixed(); >>> Do you consider this a legal C code if without module-plts.o the function would not exist at all? >>> That's too much relying on optimizer I think... >>> >> Yes, we rely on that in many different places in the kernel. > > https://www.kernel.org/doc/Documentation/process/coding-style.rst: > "However, this approach still allows the C compiler to see the code > inside the block, and check it for correctness (syntax, types, symbol > references, etc). Thus, you still have to use an #ifdef if the code inside the > block references symbols that will not exist if the condition is not met." > "will not exist" is ambiguous here. It is rather common to declare symbols, but only define them conditionally, and use IS_ENABLED() to refer to them. As the documentation says, this gets rid of #ifdefs, making the code always visible to the compiler which is a good thing.