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 E8252C433EF for ; Sun, 23 Jan 2022 10:48:39 +0000 (UTC) Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94.2) (envelope-from ) id 1nBaPt-0001ki-UJ; Sun, 23 Jan 2022 05:48:13 -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 1nBaPr-0001kc-N8 for kernelnewbies@kernelnewbies.org; Sun, 23 Jan 2022 05:48:12 -0500 Received: from unknown (HELO send002-relay.gov-dooray.com) (211.180.235.153) by 129.254.9.16 with ESMTP; 23 Jan 2022 19:48:02 +0900 X-Original-SENDERIP: 211.180.235.153 X-Original-MAILFROM: ckim@etri.re.kr X-Original-RCPTTO: kernelnewbies@kernelnewbies.org Received: from [10.162.225.106] (HELO smtp001-imp.gov-dooray.com) ([10.162.225.106]) by send002-relay.gov-dooray.com with SMTP id 90bed9bd61ed3262; Sun, 23 Jan 2022 19:48:02 +0900 DKIM-Signature: a=rsa-sha256; b=rCpY/eD+R8dpyxYeNUqrnbeNYFpxt/nMdnBARmexWrbow6ZgN6C8uytIDGSVDy9Q1f8GBP0qPs lW/g3hG4xNLPI1ED++lt6m8RiBxawFAzQlgTdLW7vNezwpoKII+HRPUW6gd+zWQ1sd3yv1Q/04KA A7HZzPUO9RKlULL/0qd6U4X5BU85Ks9CqGy3ffB+V5Y7fYSCNeBNfyvulNavHkL37yb0Kcy0ruX/ h51uV6Ml3DRMtIaBG7BmhrGUJmR+r2Ap4cISmX7uEGHbrF6GeMZmbQxV9cdbIeWF6LpknBfjTFlz X3/LKRZTWihxJwNMdl26bU12h4OUgzmzNQNk9+OA==; c=relaxed/relaxed; s=selector; d=dooray.com; v=1; bh=NwO/tshmsWmiJD/HxlSHznpAG5ppvayNcml2WA0q9Q8=; h=From:To:Subject:Message-ID; Received: from [129.254.132.39] (HELO CHANKIMPC) ([129.254.132.39]) by smtp001-imp.gov-dooray.com with SMTP id 1c4c068061ed3262; Sun, 23 Jan 2022 19:48:02 +0900 From: "Chan Kim" To: Subject: how to fix section mismatch warning after inserting #pragma GCC optimize ? Date: Sun, 23 Jan 2022 19:48:01 +0900 Message-ID: <038c01d81046$b19c5f40$14d51dc0$@etri.re.kr> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AdgQRqICa9G6pyXfQb66Hkx8fbXTwg== 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="===============7375892840450877468==" Errors-To: kernelnewbies-bounces@kernelnewbies.org This is a multipart message in MIME format. --===============7375892840450877468== Content-Type: multipart/alternative; boundary="----=_NextPart_000_038D_01D81092.218518B0" Content-Language: ko This is a multipart message in MIME format. ------=_NextPart_000_038D_01D81092.218518B0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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_038D_01D81092.218518B0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

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_038D_01D81092.218518B0-- --===============7375892840450877468== 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 --===============7375892840450877468==--