From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 863DFC433EF for ; Wed, 6 Oct 2021 02:59:03 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A0D0A6120F for ; Wed, 6 Oct 2021 02:59:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A0D0A6120F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=etri.re.kr Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94.2) (envelope-from ) id 1mXx8d-0006Rn-Qz; Tue, 05 Oct 2021 22:58:35 -0400 Received: from mscreen.etri.re.kr ([129.254.9.16]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (Exim 4.94.2) (envelope-from ) id 1mXx8a-0006Q6-RI for kernelnewbies@kernelnewbies.org; Tue, 05 Oct 2021 22:58:33 -0400 Received: from unknown (HELO send001-relay.gov-dooray.com) (211.180.235.152) by 129.254.9.16 with ESMTP; 6 Oct 2021 11:58:23 +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.106] (HELO smtp001-imp.gov-dooray.com) ([10.162.225.106]) by send001-relay.gov-dooray.com with SMTP id becdc938615d10cf; Wed, 06 Oct 2021 11:58:23 +0900 DKIM-Signature: a=rsa-sha256; b=HXsZ7uiQSFL2kZl1syMgWtBihtNI9w+4ZdDNyiuMmBk5eVHGfXAv5/8iF8VGvvrL71I5PJ8KjM he7KKJoMI1prNG3It3o/3/ye5yw78oJM7fCy1r1fccQVYR2pPecw9EAgyuiX1Ij9RjN2RGHGDjaY YX0Kssv69y/qTeE3mWuKqW1muCkY/dpuGYFqMwEaefMPBQv+Az13/jn75iWOZ13JLJ5DpA3lwt1k aCBvRhyVcW9tRYU9jPJXIn5T9DnSyT7MWslDVhevU440m25kXOsCWXUhgimQndGb5gFVOmNaDhJ9 XpnmDrBULladT2NW1ZfdFXQIpIMhWCOfMJXwGTRQ==; c=relaxed/relaxed; s=selector; d=dooray.com; v=1; bh=O9bxb1EgCC+yvwvrUzzZ9jLRTjZipKPsr8MrfJxYoBA=; 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 8a671f61615d10cf; Wed, 06 Oct 2021 11:58:23 +0900 From: To: Subject: error: impossible constraint in 'asm' when compiling kernel code with -O0 option Date: Wed, 6 Oct 2021 11:58:21 +0900 Message-ID: <022a01d7ba5e$05ddc0b0$11994210$@etri.re.kr> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: Ade6Vns1V90e1XqtSW+qbaWYfwkwFg== 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="===============7919507944092916823==" Errors-To: kernelnewbies-bounces@kernelnewbies.org This is a multipart message in MIME format. --===============7919507944092916823== Content-Type: multipart/alternative; boundary="----=_NextPart_000_022B_01D7BAA9.75C67A20" Content-Language: ko This is a multipart message in MIME format. ------=_NextPart_000_022B_01D7BAA9.75C67A20 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit In linux-5.4.21 code, To prevent some variables from being 'optimized out' during kernel code analysis using gdb, I added in drivers/iommu/Makefile, (replacing -O2 flags to -O0 flags for some files, I found http://www.joelfernandes.org/linux/2018/06/10/kernel-gdb.html ) CFLAGS_REMOVE_arm-smmu.o := -O2 CFLAGS_REMOVE_arm-smmu-impl.o := -O2 CFLAGS_REMOVE_io-pgtable-arm-v7s.o := -O2 CFLAGS_REMOVE_io-pgtable-arm.o := -O2 CFLAGS_REMOVE_of_iommu.o := -O2 CFLAGS_REMOVE_arm-smmu-v3.o := -O2 CFLAGS_arm-smmu.o := -O0 CFLAGS_arm-smmu-impl.o := -O0 CFLAGS_io-pgtable-arm-v7s.o := -O0 CFLAGS_io-pgtable-arm.o := -O0 CFLAGS_of_iommu.o := -O0 CFLAGS_arm-smmu-v3.o := -O0 But when I do make ARCH=arm64 CROSS_COMPILE=aarch64-none-elf- Image, I get CALL scripts/checksyscalls.sh CALL scripts/atomic/check-atomics.sh CHK include/generated/compile.h CC drivers/iommu/io-pgtable-arm.o In file included from ././include/linux/compiler_types.h:68, from : ./arch/arm64/include/asm/jump_label.h: In function 'system_uses_lse_atomics': ./include/linux/compiler-gcc.h:120:38: warning: asm operand 0 probably doesn't match constraints 120 | #define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) | ^~~ ./arch/arm64/include/asm/jump_label.h:38:2: note: in expansion of macro 'asm_volatile_goto' 38 | asm_volatile_goto( | ^~~~~~~~~~~~~~~~~ ./include/linux/compiler-gcc.h:120:38: warning: asm operand 0 probably doesn't match constraints 120 | #define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) | ^~~ ./arch/arm64/include/asm/jump_label.h:38:2: note: in expansion of macro 'asm_volatile_goto' 38 | asm_volatile_goto( | ^~~~~~~~~~~~~~~~~ ./include/linux/compiler-gcc.h:120:38: error: impossible constraint in 'asm' 120 | #define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) | ^~~ ./arch/arm64/include/asm/jump_label.h:38:2: note: in expansion of macro 'asm_volatile_goto' 38 | asm_volatile_goto( | ^~~~~~~~~~~~~~~~~ ./include/linux/compiler-gcc.h:120:38: error: impossible constraint in 'asm' 120 | #define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) | ^~~ ./arch/arm64/include/asm/jump_label.h:38:2: note: in expansion of macro 'asm_volatile_goto' 38 | asm_volatile_goto( | ^~~~~~~~~~~~~~~~~ make[2]: *** [scripts/Makefile.build:266: drivers/iommu/io-pgtable-arm.o] Error 1 make[1]: *** [scripts/Makefile.build:509: drivers/iommu] Error 2 make: *** [Makefile:1652: drivers] Error 2 Does anybody know how can I use -O0 flag? (I tried -Og flag but some variables are still optimized out). Thank you! Chan Kim ------=_NextPart_000_022B_01D7BAA9.75C67A20 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

In linux-5.4.21 = code,

To = prevent some variables from being ‘optimized out’ during = kernel code analysis using gdb, I added in = drivers/iommu/Makefile,

(replacing -O2 flags to -O0 flags for some files,  I = found ht= tp://www.joelfernandes.org/linux/2018/06/10/kernel-gdb.html = )

CFLAGS_REMOVE_arm-smmu.o :=3D -O2

CFLAGS_REMOVE_arm-smmu-impl.o :=3D = -O2

CFLAGS_REMOVE_io-pgtable-arm-v7s.o :=3D = -O2

CFLAGS_REMOVE_io-pgtable-arm.o :=3D = -O2

CFLAGS_REMOVE_of_iommu.o :=3D -O2

CFLAGS_REMOVE_arm-smmu-v3.o :=3D = -O2

CFLAGS_arm-smmu.o :=3D -O0

CFLAGS_arm-smmu-impl.o :=3D -O0

CFLAGS_io-pgtable-arm-v7s.o :=3D = -O0

CFLAGS_io-pgtable-arm.o :=3D -O0

CFLAGS_of_iommu.o :=3D -O0

CFLAGS_arm-smmu-v3.o :=3D -O0

But when I do make ARCH=3Darm64 = CROSS_COMPILE=3Daarch64-none-elf- Image, I get

CALL    = scripts/checksyscalls.sh

  CALL    = scripts/atomic/check-atomics.sh

  CHK     = include/generated/compile.h

  CC      = drivers/iommu/io-pgtable-arm.o

In file included from = ././include/linux/compiler_types.h:68,

          =        from = <command-line>:

./arch/arm64/include/asm/jump_label.h: In function = 'system_uses_lse_atomics':

./include/linux/compiler-gcc.h:120:38: warning: asm operand = 0 probably doesn't match constraints

  120 | #define asm_volatile_goto(x...) do { asm = goto(x); asm (""); } while (0)

      = |            =             &= nbsp;           &n= bsp; ^~~

./arch/arm64/include/asm/jump_label.h:38:2: note: in = expansion of macro 'asm_volatile_goto'

   38 |  = asm_volatile_goto(

      |  = ^~~~~~~~~~~~~~~~~

./include/linux/compiler-gcc.h:120:38: warning: asm operand = 0 probably doesn't match constraints

  120 | #define asm_volatile_goto(x...) do { asm = goto(x); asm (""); } while (0)

      = |            =             &= nbsp;           &n= bsp; ^~~

./arch/arm64/include/asm/jump_label.h:38:2: note: in = expansion of macro 'asm_volatile_goto'

   38 |  = asm_volatile_goto(

      |  = ^~~~~~~~~~~~~~~~~

./include/linux/compiler-gcc.h:120:38: error: impossible = constraint in 'asm'

  120 | #define asm_volatile_goto(x...) do { asm = goto(x); asm (""); } while (0)

      = |            =             &= nbsp;           &n= bsp; ^~~

./arch/arm64/include/asm/jump_label.h:38:2: note: in = expansion of macro 'asm_volatile_goto'

   38 |  = asm_volatile_goto(

      |  = ^~~~~~~~~~~~~~~~~

./include/linux/compiler-gcc.h:120:38: error: impossible = constraint in 'asm'

  120 | #define asm_volatile_goto(x...) do { asm = goto(x); asm (""); } while (0)

      = |            =             &= nbsp;           &n= bsp; ^~~

./arch/arm64/include/asm/jump_label.h:38:2: note: in = expansion of macro 'asm_volatile_goto'

   38 |  = asm_volatile_goto(

      |  = ^~~~~~~~~~~~~~~~~

make[2]: *** [scripts/Makefile.build:266: = drivers/iommu/io-pgtable-arm.o] Error 1

make[1]: *** [scripts/Makefile.build:509: drivers/iommu] = Error 2

make: *** [Makefile:1652: drivers] Error = 2

Does = anybody know how can I use -O0 flag? (I tried -Og flag but some = variables are still optimized out).

Thank you!

Chan Kim

 

------=_NextPart_000_022B_01D7BAA9.75C67A20-- --===============7919507944092916823== 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 --===============7919507944092916823==--