Can't compile linux kernel with -Og/-O0 option for debugging purpoces
1
vote
0
answers
430
views
Having custom hardware running embedded Linux (OpenWrt) like a charm. CPU - is IMX6ULL (ArmV7) so it is supported by Jlink to debug over JTAG interface.
Starting GDB server and step by step debugging Linux kernel shows lot of
optimized out
messages because of kernel compiled with KBUILD_CFLAGS += -O2 -fno-reorder-blocks -fno-tree-ch $(EXTRA_OPTIMIZATION)
flag.
So I am trying to compile it with -O0
that provides me following option:
$ make -j64 V=s all
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CC scripts/mod/empty.o
....
AR built-in.o
LD vmlinux.o
MODPOST vmlinux.o
WARNING: modpost: Found 4 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
arm-openwrt-linux-muslgnueabi-ld: arch/arm/kernel/setup.o: in function `setup_arch':
/opt/eclipse/imx6ull-openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-imx6ull_cortexa7/linux-4.14.199/arch/arm/kernel/setup.c:1134: undefined reference to `psci_smp_ops'
arm-openwrt-linux-muslgnueabi-ld: /opt/eclipse/imx6ull-openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-imx6ull_cortexa7/linux-4.14.199/arch/arm/kernel/setup.c:1134: undefined reference to `psci_smp_ops'
arm-openwrt-linux-muslgnueabi-ld: kernel/panic.o: in function `__xchg':
/opt/eclipse/imx6ull-openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-imx6ull_cortexa7/linux-4.14.199/./arch/arm/include/asm/cmpxchg.h:110: undefined reference to `__bad_xchg'
arm-openwrt-linux-muslgnueabi-ld: kernel/exit.o: in function `__xchg':
Checked for WARNING: modpost: Found x section mismatch(es).
here . Seems that resulted binary file takes more space then configured by some settings. The vmlinux
size built with -O2
option is 39Mb
. Using -O1
gives me 37Mb
image so I hope there is enough space in my DDR3 RAM (128Mb) to feet for even bigger image compiled with -O0
configuration. So I am wondering about way to provide more space for sections? Could someone please point me to place I can do it? Have limited knowledge about Linux kernel so was unable to find any linker script used for that.
Asked by user3583807
(111 rep)
Oct 22, 2021, 12:06 PM