"objtool orc" creates invalid file arch/x86/kernel/time.o

From: Arnd Bergmann
Date: Sun Sep 10 2017 - 16:39:05 EST


Hi Josh,

I have a randconfig build that produces a link error:

built-in.o: member arch/x86/kernel/time.o in archive is not an object

I've traced it down to the "objtool orc generate" command that appears
to corrupt the file, by running the same commands that 'make' calls:

arnd@wuerfel:/git/arm-soc/build/x86/0xF20D8DD8_defconfig$
/home/arnd/cross-gcc/bin/x86_64-linux-gcc-8.0.0 -Werror
-Wa,--fatal-warnings -DKCONFIG_SEED= -Wp,-MD,arch/x86/kernel/.time.o.d
-nostdinc -isystem
/home/arnd/cross-gcc/lib/gcc/x86_64-linux/8.0.0/include
-I/git/arm-soc/arch/x86/include -I./arch/x86/include/generated
-I/git/arm-soc/include -I./include
-I/git/arm-soc/arch/x86/include/uapi
-I./arch/x86/include/generated/uapi -I/git/arm-soc/include/uapi
-I./include/generated/uapi -include
/git/arm-soc/include/linux/kconfig.h -I/git/arm-soc/arch/x86/kernel
-Iarch/x86/kernel -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes
-Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar
-Werror-implicit-function-declaration -Wno-format-security -std=gnu89
-fno-PIE -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64
-falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387
-mpreferred-stack-boundary=3 -mskip-rax-setup -march=k8 -mno-red-zone
-mcmodel=kernel -funit-at-a-time -DCONFIG_AS_CFI=1
-DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1
-DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_CRC32=1
-DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1
-DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -pipe -Wno-sign-compare
-fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks
-Wno-frame-address -Os -Wno-maybe-uninitialized
--param=allow-store-data-races=0 -DCC_HAVE_ASM_GOTO
-Wframe-larger-than=2048 -fstack-protector
-Wno-unused-but-set-variable -Wno-unused-const-variable
-fomit-frame-pointer -fno-var-tracking-assignments
-fno-inline-functions-called-once -Wdeclaration-after-statement
-Wno-pointer-sign -fno-strict-overflow -fconserve-stack
-Werror=implicit-int -Werror=strict-prototypes -Werror=date-time
-Werror=incompatible-pointer-types -Werror=designated-init
-Wformat-truncation=0 -Wno-packed-not-aligned
-DKBUILD_BASENAME='"time"' -DKBUILD_MODNAME='"time"' -c -o
arch/x86/kernel/time.o /git/arm-soc/arch/x86/kernel/time.c
arnd@wuerfel:/git/arm-soc/build/x86/0xF20D8DD8_defconfig$ nm
arch/x86/kernel/time.o | head U global_clock_event
U hpet_enable
000000000000000b T hpet_time_init
U in_lock_functions
0000000000000000 d irq0
0000000000000000 D jiffies
U late_time_init
U legacy_pic
0000000000000012 T profile_pc
U setup_irq
arnd@wuerfel:/git/arm-soc/build/x86/0xF20D8DD8_defconfig$
./tools/objtool/objtool orc generate --no-fp "arch/x86/kernel/time.o"
arnd@wuerfel:/git/arm-soc/build/x86/0xF20D8DD8_defconfig$ nm
arch/x86/kernel/time.o
nm: arch/x86/kernel/time.o: File format not recognized

I attached both versions of the object file here, plus the .config
file, please have a look.

Arnd

Attachment: time-after-orc.o
Description: application/object

Attachment: time-from-gcc.o
Description: application/object

Attachment: config-broken-orc
Description: Binary data