https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103241
--- Comment #2 from Will Cohen <wcohen at redhat dot com> ---
Yes, the kernel vmlinux is too large and isn't a great reproducer for this.
Need a much smaller example. Trying to compile just the
linux/arch/x86/mm/pat/set_memory.c with -save-temps to provide a better view of
what GCC is doing. From the output of llvm-dwarfdump there seems to be two
flavors of 0-length location list entries:
-At the very beginning of the function "start" has "[0xffffffff8107a540,
0xffffffff8107a540): DW_OP_reg5 RDI" followed by "[0xffffffff8107a540,
0xffffffff8107a569): DW_OP_reg5 RDI, DW_OP_piece 0x8"
-The function is has two regions:
[0xffffffff8107a540, 0xffffffff8107a6cb)
[0xffffffff81bc6967, 0xffffffff81bc6a24))
A number of the arguments have 0-length location lists of the form (for
"start"):
[0xffffffff8107a6cb, 0xffffffff8107a6cb): DW_OP_reg4 RSI
Removed the arch/x86/mm/pat/set_memory.o file from kernel build, did a "make
V=1 > problems". Extracted the command line and added a -save-temps:
gcc -save-temps -Wp,-MMD,arch/x86/mm/pat/.set_memory.o.d -nostdinc
-I./arch/x86/include -I./arch/x86/include/generated -I./include
-I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi
-I./include/generated/uapi -include ./include/linux/compiler-version.h -include
./include/linux/kconfig.h -include ./include/linux/compiler_types.h
-D__KERNEL__ -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes
-Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE
-Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type
-Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx
-fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387
-mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic
-mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables
-mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables
-fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation
-Wno-format-overflow -Wno-address-of-packed-member -O2
-fno-allow-store-data-races -Wframe-larger-than=2048 -fstack-protector -Werror
"-Wimplicit-fallthrough=5" -Wno-main -Wno-unused-but-set-variable
-Wno-unused-const-variable -fno-stack-clash-protection -pg -mrecord-mcount
-mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wvla
-Wno-pointer-sign -Wno-stringop-truncation -Wno-zero-length-bounds
-Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized
-Wno-alloc-size-larger-than -fno-strict-overflow -fno-stack-check
-fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types
-Werror=designated-init -Wno-packed-not-aligned -g
-DKBUILD_MODFILE='"arch/x86/mm/pat/set_memory"'
-DKBUILD_BASENAME='"set_memory"' -DKBUILD_MODNAME='"set_memory"'
-D__KBUILD_MODNAME=kmod_set_memory -c -o arch/x86/mm/pat/set_memory.o
arch/x86/mm/pat/set_memory.c ; ./tools/objtool/objtool orc generate --no-fp
--retpoline --uaccess arch/x86/mm/pat/set_memory.o
The set_memory.s is still pretty large, but shows what the gcc is generating
for the debuginfo.