linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: robin.murphy@arm.com (Robin Murphy)
To: linux-arm-kernel@lists.infradead.org
Subject: arch/arm/kernel/setup.c does not compile at -O0
Date: Thu, 30 Jul 2015 14:14:29 +0100	[thread overview]
Message-ID: <55BA2335.706@arm.com> (raw)
In-Reply-To: <55BA1E62.9080103@free.fr>

On 30/07/15 13:53, Mason wrote:
> Hello everyone,
>
> I'm trying to debug a live kernel (v3.14) using a DS-5 JTAG probe.
>
> In order to make the control flow easier to follow, I disabled
> optimizations by adding
>
>    subdir-ccflags-y := -O0
>
> to arch/arm/kernel/Makefile
>
> With that change, linking fails:
>
> arch/arm/kernel/setup.c:924: undefined reference to `psci_smp_ops'
>
>        if (psci_smp_available())
>          smp_set_ops(&psci_smp_ops);
>
> #ifdef CONFIG_ARM_PSCI
> void psci_init(void);
> bool psci_smp_available(void);
> #else
> static inline void psci_init(void) { }
> static inline bool psci_smp_available(void) { return false; }
> #endif
>
> The optimizer is able to remove the entire block, but this
> does not happen when optimizations are disabled.
>
> Is compiling at -O0 not supported?
>
>
> My larger problem: the DS-5 debugger refuses to show the value
> of local variables. As a work-around, I can make some variables
> global, but it's really inconvenient.
>
> I checked that CONFIG_FRAME_POINTER=y
> and source files are compiled with -g
>
> arm-linux-gnueabihf-gcc -Wp,-MD,init/.main.o.d  -nostdinc -isystem /opt/gcc-linaro-2014.11/bin/../lib/gcc/arm-linux-gnueabihf/4.9.3/include -I/opt/linux/arch/arm/include -Iarch/arm/include/generated  -Iinclude -I/opt/linux/arch/arm/include/uapi -Iarch/arm/include/generated/uapi -I/opt/linux/include/uapi -Iinclude/generated/uapi -include /opt/linux/include/linux/kconfig.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-tangox/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -std=gnu89 -O2 -fno-dwarf2-cfi-asm -fno-omit-frame-pointer -mapcs -mno-sched-prolog -mabi=aapcs-linux -mno-thumb-interwork -mfpu=vfp -marm -D__LINUX_ARM_ARCH__=7 -march=armv7-a -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -g -Wdeclaration-after-statement -Wno
-
>   p
> ointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -DCC_HAVE_ASM_GOTO -O0    -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(main)"  -D"KBUILD_MODNAME=KBUILD_STR(main)" -c -o init/main.o init/main.c
>
>
> Any idea how I can get DS-5 to properly handle local variables?

I carry a patch locally reverting 2062afb4f804 - at least on arm64, the 
debugger manages to resolve optimised locals considerably better without 
the -fno-var-tracking-assignments option. The Kconfig "Generate dwarf4 
debug info" option is a good idea, and "Generate readable assembly code" 
sometimes helps a bit too.

Whilst in general -O0 isn't going to work, I've had some success using 
"__attribute__ ((optimize(0)))" on individual functions of interest.

Hope that's of some help.

Robin.

>
>
> I'm trying to convert an old-style board config to a device tree,
> and I can't even get serial to work... :-(
>
> Regards.
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>

  reply	other threads:[~2015-07-30 13:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-30 12:53 arch/arm/kernel/setup.c does not compile at -O0 Mason
2015-07-30 13:14 ` Robin Murphy [this message]
2015-07-30 13:58   ` Mason
2015-07-30 14:54     ` Mason
2015-07-30 16:09     ` Mason
2015-07-31  8:28       ` Mason
2015-07-30 13:29 ` Russell King - ARM Linux
2015-07-30 15:23 ` Suman Tripathi
2015-07-30 15:50   ` Russell King - ARM Linux
2015-07-30 16:13     ` Suman Tripathi
2015-08-20  9:07     ` Suman Tripathi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55BA2335.706@arm.com \
    --to=robin.murphy@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).