Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B24F5C433EF for ; Sun, 23 Jan 2022 11:42:45 +0000 (UTC) Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94.2) (envelope-from ) id 1nBbGT-0007Y7-DJ; Sun, 23 Jan 2022 06:42:33 -0500 Received: from mscreen.etri.re.kr ([129.254.9.16]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (Exim 4.94.2) (envelope-from ) id 1nBbGP-0007Y0-NV for kernelnewbies@kernelnewbies.org; Sun, 23 Jan 2022 06:42:30 -0500 Received: from unknown (HELO send001-relay.gov-dooray.com) (211.180.235.152) by 129.254.9.16 with ESMTP; 23 Jan 2022 20:42:24 +0900 X-Original-SENDERIP: 211.180.235.152 X-Original-MAILFROM: ckim@etri.re.kr X-Original-RCPTTO: kernelnewbies@kernelnewbies.org Received: from [10.162.225.112] (HELO smtp002-imp.gov-dooray.com) ([10.162.225.112]) by send001-relay.gov-dooray.com with SMTP id 65c0815861ed3f20; Sun, 23 Jan 2022 20:42:24 +0900 DKIM-Signature: a=rsa-sha256; b=vSHTurp15MaWZajZ/JgNPbNyTfXT69mw5ElXBYoZKXs54U2FfzPqTGfYQwrSueh+nSDq0aEgjK BbCK2jnb/XKCMNpRF/pJ9OnCZdFMVDZs5Bho71u4WV8+ZzFGzzLU9kIgXazuehTpjTswF5AP8aUz 1WaSNpZAX8XkuXsEAjW6Sj5+hUjKHmch65VS1GHwFIIJm0IVVOSmFDtvwF3Qh8NHmE9nOYnMTI70 N9E8ERYPEo7o6VyvLg4Ts242kuvFeBD56pqXyTugl5Ue2X19mURHvjuDXQ1Y+LX52tRL5M3HQ71l ncQ2bxmSUDGYiVonEONwP2tmvxh2/s6dNkdHpg1A==; c=relaxed/relaxed; s=selector; d=dooray.com; v=1; bh=ZqdXs/mgTifxjngjhwowoOEuc+3rX4h0bnLO7F8fr7U=; h=From:To:Subject:Message-ID; Received: from [129.254.132.39] (HELO CHANKIMPC) ([129.254.132.39]) by smtp002-imp.gov-dooray.com with SMTP id 64205c1e61ed3f1f; Sun, 23 Jan 2022 20:42:24 +0900 From: "Chan Kim" To: References: <038c01d81046$b19c5f40$14d51dc0$@etri.re.kr> In-Reply-To: <038c01d81046$b19c5f40$14d51dc0$@etri.re.kr> Subject: RE: how to fix section mismatch warning after inserting #pragma GCC optimize ? Date: Sun, 23 Jan 2022 20:42:23 +0900 Message-ID: <03d201d8104e$499b7d10$dcd27730$@etri.re.kr> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQL0wptn9VAKF4T40jwpzmnNLz7MX6o3FsRw Content-Language: ko X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============7261723821126115970==" Errors-To: kernelnewbies-bounces@kernelnewbies.org This is a multipart message in MIME format. --===============7261723821126115970== Content-Type: multipart/alternative; boundary="----=_NextPart_000_03D3_01D81099.B9843680" Content-Language: ko This is a multipart message in MIME format. ------=_NextPart_000_03D3_01D81099.B9843680 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit I found adding __init to gic_smp_init() removed this warning message. Is it ok to move this function to .init.text ? (doesn't it cause it to be removed after initialization?) Chan From: Chan Kim Sent: Sunday, January 23, 2022 7:48 PM To: kernelnewbies@kernelnewbies.org Subject: how to fix section mismatch warning after inserting #pragma GCC optimize ? Hello all, In linux 5.4.21 source code, I put #pragma GCC push_options #pragma GCC optimize ("O0") and #pragma GCC pop_options around function static int __init gic_init_bases in file drivers/irqchip/irq-gic-v3.c. When I build it, I get this warning message (section mismatch). ( I later found it is actually the "#pragma GCC optimize ("O0")" line that is causing it.) CALL scripts/atomic/check-atomics.sh CALL scripts/checksyscalls.sh CHK include/generated/compile.h CC arch/arm64/kernel/irq.o CC arch/arm64/kernel/setup.o CC drivers/irqchip/irq-gic-v3.o AS arch/arm64/kernel/head.o AR arch/arm64/kernel/built-in.a AR arch/arm64/built-in.a AR drivers/irqchip/built-in.a AR drivers/built-in.a GEN .version CHK include/generated/compile.h UPD include/generated/compile.h CC init/version.o AR init/built-in.a LD vmlinux.o MODPOST vmlinux.o WARNING: vmlinux.o(.text+0x227cc0): Section mismatch in reference from the function gic_smp_init() to the function .init.text:set_smp_cross_call() The function gic_smp_init() references the function __init set_smp_cross_call(). This is often because gic_smp_init lacks a __init annotation or the annotation of set_smp_cross_call is wrong. MODINFO modules.builtin.modinfo LD .tmp_vmlinux1 KSYM .tmp_kallsyms1.o LD .tmp_vmlinux2 KSYM .tmp_kallsyms2.o LD vmlinux SORTEX vmlinux SYSMAP System.map OBJCOPY arch/arm64/boot/Image Function call is like this : gic_init_bases -> gic_smp_init() -> set_smp_cross_call. (currently CONFIG_SMP=y). The message seems to say set_smp_cross_call is annotated with __init (meaning it is placed in .init.text) but gic_smp_init is not. But without the #pragma debug setting, there was not warning of this kind. I'm not sure if I can just add add __init to gic_smp_init(). (or remove _init from set_smp_cross_call ) What is the correct method to fix it? Thanks, Chan Kim ------=_NextPart_000_03D3_01D81099.B9843680 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

I found adding __init to = gic_smp_init() removed this warning message.

Is it ok to move this function to = .init.text ? (doesn’t it cause it to be removed after = initialization?)

Chan

 

From:<= /b> Chan Kim = <ckim@etri.re.kr>
Sent: Sunday, January 23, 2022 7:48 = PM
To: kernelnewbies@kernelnewbies.org
Subject: how = to fix section mismatch warning after inserting #pragma GCC optimize = ?

 

Hello all,

 

In linux 5.4.21 source code, I put

    #pragma GCC = push_options

    #pragma GCC optimize = ("O0")

and

    #pragma GCC = pop_options

around function static int __init gic_init_bases in file = drivers/irqchip/irq-gic-v3.c. 

When I build it, I get this warning = message (section mismatch).

( I later found it is actually the = “#pragma GCC optimize = ("O0")” line that is causing = it.) 

 

      CALL    = scripts/atomic/check-atomics.sh

      = CALL    scripts/checksyscalls.sh

      = CHK     = include/generated/compile.h

      = CC      = arch/arm64/kernel/irq.o

      CC      = arch/arm64/kernel/setup.o

      = CC      = drivers/irqchip/irq-gic-v3.o

      = AS      = arch/arm64/kernel/head.o

      = AR      = arch/arm64/kernel/built-in.a

      = AR      = arch/arm64/built-in.a

      = AR      = drivers/irqchip/built-in.a

      = AR      = drivers/built-in.a

      GEN     = .version

      CHK     = include/generated/compile.h

      = UPD     = include/generated/compile.h

      = CC      init/version.o

      = AR      init/built-in.a

      = LD      vmlinux.o

      = MODPOST vmlinux.o

    WARNING: vmlinux.o(.text+0x227cc0): = Section mismatch in reference from the function gic_smp_init() to the = function .init.text:set_smp_cross_call()

    The function = gic_smp_init() references

    the function = __init set_smp_cross_call().

    This is often = because gic_smp_init lacks a __init

    annotation = or the annotation of set_smp_cross_call is = wrong.

   

      MODINFO = modules.builtin.modinfo

      = LD      .tmp_vmlinux1

      = KSYM    .tmp_kallsyms1.o

  =     LD      = .tmp_vmlinux2

      KSYM    = .tmp_kallsyms2.o

      = LD      vmlinux

      = SORTEX  vmlinux

      SYSMAP  = System.map

      OBJCOPY = arch/arm64/boot/Image

 

Function call is like this : gic_init_bases -> = gic_smp_init() -> set_smp_cross_call. (currently CONFIG_SMP=3Dy). =

The = message seems to say set_smp_cross_call is annotated with __init = (meaning it is placed in .init.text) but gic_smp_init is not. =

But = without the #pragma debug setting, there was not warning of this kind. =

I'm not = sure if I can just add add __init to gic_smp_init(). (or remove _init = from set_smp_cross_call )

What is the correct method to fix = it?

Thanks,

Chan Kim

------=_NextPart_000_03D3_01D81099.B9843680-- --===============7261723821126115970== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies --===============7261723821126115970==--