kexec-tools-2.0.1 and CFLAGS

Magnus Damm magnus.damm at gmail.com
Thu Aug 20 09:14:19 EDT 2009


Hi Simon, Everyone,

Kexec-tools 2.0.1 seems to build only with optimization enabled. If I
set CFLAGS before calling configure and remove the "-O2" then the code
won't link properly. I found it while cross compiling for SuperH, but
it's most likely an issue on other platforms as well. Have a look at
the "-O0" below:

 $ AR=_ar CC=_gcc CFLAGS="-O0" LDFLAGS="-static" ./configure
--prefix=/ --host="sh3-linux" --without-zlib --without-xen
....
$ make
...
_gcc -static  -o build/sbin/kexec kexec/kexec.o kexec/ifdown.o
kexec/kexec-elf.o kexec/kexec-elf-exec.o kexec/kexec-elf-core.o
kexec/kexec-elf-rel.o kexec/kexec-elf-boot.o kexec/kexec-iomem.o
kexec/firmware_memmap.o kexec/crashdump.o kexec/crashdump-xen.o
kexec/phys_arch.o kexec/proc_iomem.o kexec/arch_reuse_initrd.o
kexec/arch/sh/kexec-sh.o kexec/arch/sh/kexec-zImage-sh.o
kexec/arch/sh/kexec-netbsd-sh.o kexec/arch/sh/kexec-elf-sh.o
kexec/arch/sh/kexec-elf-rel-sh.o kexec/arch/sh/netbsd_booter.o
kexec/arch/sh/crashdump-sh.o kexec/purgatory.o libutil.a
kexec/arch/sh/kexec-elf-rel-sh.o: In function `machine_apply_elf_rel':
kexec-elf-rel-sh.c:(.text+0x1b0): undefined reference to
`bad_unaligned_access_length'
kexec-elf-rel-sh.c:(.text+0x288): undefined reference to
`bad_unaligned_access_length'
collect2: ld returned 1 exit status
make: *** [build/sbin/kexec] Error 1

This issue is most likely related to get_unaligned() and
put_unaligned() having bad_unaligned_access_length() in their default
case that never gets optimized away.

Anyway, not very important. But at least you know now. =)

Cheers,

/ magnus



More information about the kexec mailing list