Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp50749rdf; Thu, 2 Nov 2023 13:28:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH829wJB3XbKJ4otMDQcRgR6Z7fLJ3uKfsaPhjYVcfAiG0FywRSo3bzqGrltTy1pfeEfsqJ X-Received: by 2002:a17:903:41c6:b0:1cc:55d4:a715 with SMTP id u6-20020a17090341c600b001cc55d4a715mr723864ple.3.1698956936954; Thu, 02 Nov 2023 13:28:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698956936; cv=none; d=google.com; s=arc-20160816; b=ittR0+ErWkIJYvuP9UKL2i10PlpGgvmYEzX8psxE4dVMy/ndwR9GO2aNkpNHmJEYpS gBFW2eU20zafKS/5uFqT+pi6Dpk8lhcOTBVkFdrEmF7AXE1p8xh9iM4iInd/fZnMc6tm GCVvZMEwg0ZGpMIAbJGeJZqGvGTuu51KvQzEjcgyFR92XQyPKY5QtXqGPVG6njdxa2dm MKrkiWf8t/P3UYC3be+jxmcgP3MTu0301cFub9IwCGFP0RYEJhzRKouk3m+Ari79eTS0 8YzhR71KSdFh+Jzu58+oWv2wf2BbE9DeeKp5ua/ww68Us/dz0EC36i3/dN6oLxAC7UBP ferQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=fvELio57whLcYbbcNX1dQl7yCH9mJUY5mr/DdMdc2L0=; fh=nLu+Wmt8f3gUfeAn9snIRTpz72EKK/xks3gxQfGGOSM=; b=BJBBz8f5mO4gYN9eLHDA6pWX35jT9vbyDcEZzEuYBzUOWCGhc+mvAO4EHODizrMQHr N0USqzfi+Z27K9j3XZNu8tJv8SH+CffS0lDjzOuajf7PJYPsZE0O0HS9aq20UzN+PIFs QLsbYwhXSlhtgAtQOyAX7JRhl8VubDGVK+7sXe92qt0bRlVhXlhPSfLEnrtirV3EmN9s LnYev7Hny3gcLkZOi4qnJlUwAsSl9KDetw2V2mPm5tDroKv2rLJKqk0suxUxOcQOvG/h 7bK+k3WIy5c+Lq0QunWnVBwFJ6wJS801NxXqKE+ipvpBQIgVNu/475BR2+JhruiOkrfD yolA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id r18-20020a170903411200b001b3fb1742e4si199660pld.547.2023.11.02.13.28.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 13:28:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id E7AA2810CA91; Thu, 2 Nov 2023 13:28:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234186AbjKBU2m (ORCPT + 99 others); Thu, 2 Nov 2023 16:28:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233952AbjKBU2l (ORCPT ); Thu, 2 Nov 2023 16:28:41 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0475B18E; Thu, 2 Nov 2023 13:28:39 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6A40C433C9; Thu, 2 Nov 2023 20:28:37 +0000 (UTC) Date: Thu, 2 Nov 2023 16:28:35 -0400 From: Steven Rostedt To: John Paul Adrian Glaubitz Cc: kernel test robot , oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org, Yoshinori Sato , Rich Felker , linux-sh@vger.kernel.org Subject: Re: arch/sh/boot/compressed/misc.c:118:6: warning: no previous prototype for 'arch_ftrace_ops_list_func' Message-ID: <20231102162835.6263ca7f@gandalf.local.home> In-Reply-To: <8290ed7ea51c1fb6c30c9aa140dd051c39bc6e26.camel@physik.fu-berlin.de> References: <202310310611.5RteDpO7-lkp@intel.com> <20231030183722.21712d18@gandalf.local.home> <8290ed7ea51c1fb6c30c9aa140dd051c39bc6e26.camel@physik.fu-berlin.de> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 02 Nov 2023 13:28:54 -0700 (PDT) On Thu, 02 Nov 2023 21:05:29 +0100 John Paul Adrian Glaubitz wrote: > > > All warnings (new ones prefixed by >>): > > > > > > arch/sh/boot/compressed/misc.c:109:6: warning: no previous prototype for '__stack_chk_fail' [-Wmissing-prototypes] > > > 109 | void __stack_chk_fail(void) > > > | ^~~~~~~~~~~~~~~~ > > > arch/sh/boot/compressed/misc.c:115:6: warning: no previous prototype for 'ftrace_stub' [-Wmissing-prototypes] > > > 115 | void ftrace_stub(void) > > > | ^~~~~~~~~~~ > > > > > arch/sh/boot/compressed/misc.c:118:6: warning: no previous prototype for 'arch_ftrace_ops_list_func' [-Wmissing-prototypes] > > > 118 | void arch_ftrace_ops_list_func(void) > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~ > > > > As the comment states, this is needed only because the linker script > > vmlinux.lds.h references them, and it will not build without it. > > > > If someone really cares, they could simply add a header to quiet these > > warnings, but seriously, these functions are just stubs to allow the sh > > boot portion use the vmlinux.lds.h linker script. These stubs are only for > > satisfying linker references and are not used. I'm not going to be the one > > to bother "fixing" it. > > I have to admit that I don't fully understand what the problem is. > > Is this just a cosmetic issue? I would be willing to fix it in any case. I'm not sure it really needs to be fixed. But I won't complain if you do. Anyway, the issue is that arch/sh/boot/compressed/misc.c is not part of the kernel. It's the code that decompresses the vmlinuz (or whatever sh calls it). That is, the build will build the kernel (vmlinux) then compress it and add a program to decompress it (vmlinuz). At least this is what is done on x86, and I'm assuming it's the same for sh. The vmlinuz is stored on disk, the boot loader loads it into memory and executes it. The vmlinuz has the code to decompress the attached vmlinux into memory and jump to that when its done. Thus, you have two executables. The kernel and this wrapper program that decompresses the kernel at start up (and is freed right afterward). This wrapper code exists in arch/sh/boot (and in arch/x86/boot for x86). As this code needs to be built just like the kernel, it uses the same linker script as the kernel (vmlinux.lds.h), which has some references to vmlinux code. Those include (from the warnings in this "bug"): arch/sh/boot/compressed/misc.c:115:6: warning: no previous prototype for 'ftrace_stub' [-Wmissing-prototypes] 115 | void ftrace_stub(void) | ^~~~~~~~~~~ >> arch/sh/boot/compressed/misc.c:118:6: warning: no previous prototype for 'arch_ftrace_ops_list_func' [-Wmissing-prototypes] 118 | void arch_ftrace_ops_list_func(void) | ^~~~~~~~~~~~~~~~~~~~~~~~~ Which are referenced by include/asm-generic/vmlinux.lds.h, and if you do not include them, then linking will fail as these will be undefined references. Note, that bug also has: arch/sh/boot/compressed/misc.c:109:6: warning: no previous prototype for '__stack_chk_fail' [-Wmissing-prototypes] 109 | void __stack_chk_fail(void) | ^~~~~~~~~~~~~~~~ Which has a reference added by the compiler for stack protection options. arch/sh/boot/compressed/misc.c:128:6: warning: no previous prototype for 'decompress_kernel' [-Wmissing-prototypes] 128 | void decompress_kernel(void) Which is called by arch/sh/boot/compressed/head_*.S, which is assembly. None of these really need prototypes, as there's nothing that would use the prototypes. The two ftrace function stubs do not even add parameters to match the vmlinux prototype, because they are never called. The other two functions are either for gcc internal usage or called from assembly, both which do not care about seeing a prototype either. If you want to quiet gcc, you can add in arch/sh/boot/compressed, a header file called "stubs.h" that just has: #ifndef _STUBS_H #define _STUBS_H /* Quiet gcc complaining about these prototypes */ void __stack_chk_fail(void); void decompress_kernel(void); void ftrace_stub(void); void arch_ftrace_ops_list_func(void); #endif and include that header. -- Steve