Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 740838 - app-emulation/qemu-9999 - ld: tests/plugin/libempty.so.p/empty.c.o: in function `qemu_plugin_install': empty.c:(.text+0x1c): undefined reference to `qemu_plugin_register_vcpu_tb_trans_cb'
Summary: app-emulation/qemu-9999 - ld: tests/plugin/libempty.so.p/empty.c.o: in functi...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Matthias Maier
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-07 08:10 UTC by Rafael Kitover
Modified: 2020-09-18 23:47 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge--info.txt,20.91 KB, text/plain)
2020-09-07 08:10 UTC, Rafael Kitover
Details
build log (build.log.xz,26.34 KB, application/x-xz)
2020-09-07 08:10 UTC, Rafael Kitover
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rafael Kitover 2020-09-07 08:10:14 UTC
x86_64-pc-linux-gnu-gcc  -o tests/plugin/libempty.so tests/plugin/libempty.so.p/empty.c.o -Wl,--as-needed -Wl,--allow-shlib-undefined -shared -fPIC -Wl,--start-group -Wl,-soname,libempty.so -Wl,--warn-common -Wl,-
z,relro -Wl,-z,now -m64 -fstack-protector-strong -fPIE -DPIE -std=gnu99 -Wall -pie -Wl,-O1 -Wl,--as-needed -Wl,--export-dynamic -pthread -lgmodule-2.0 -lglib-2.0 -lglib-2.0 -Wl,--end-group                         
x86_64-pc-linux-gnu-gcc  -o tests/plugin/libhotpages.so tests/plugin/libhotpages.so.p/hotpages.c.o -Wl,--as-needed -Wl,--allow-shlib-undefined -shared -fPIC -Wl,--start-group -Wl,-soname,libhotpages.so -Wl,--warn-
common -Wl,-z,relro -Wl,-z,now -m64 -fstack-protector-strong -fPIE -DPIE -std=gnu99 -Wall -pie -Wl,-O1 -Wl,--as-needed -Wl,--export-dynamic -pthread -lgmodule-2.0 -lglib-2.0 -lglib-2.0 -Wl,--end-group             
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib64/Scrt1.o: in function `_start':                                             
(.text+0x20): undefined reference to `main'                                                                                                                                                                          
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: tests/plugin/libempty.so.p/empty.c.o: in function `qemu_plugin_install':                                                             empty.c:(.text+0x1c): undefined reference to `qemu_plugin_register_vcpu_tb_trans_cb'                                                                                                                                 collect2: error: ld returned 1 exit status                                                                                                                                                                           /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib64/Scrt1.o: in function `_start':                                             (.text+0x20): undefined reference to `main'                                                                                                                                                                          
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: tests/plugin/libhotpages.so.p/hotpages.c.o: in function `vcpu_tb_trans':                                                             
hotpages.c:(.text+0xb1): undefined reference to `qemu_plugin_tb_n_insns'                                                                                                                                             /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: hotpages.c:(.text+0xdb): undefined reference to `qemu_plugin_tb_get_insn'                                                            
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: hotpages.c:(.text+0xf0): undefined reference to `qemu_plugin_register_vcpu_mem_cb'                                                   
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: tests/plugin/libhotpages.so.p/hotpages.c.o: in function `vcpu_haddr':                                                                
hotpages.c:(.text+0x128): undefined reference to `qemu_plugin_get_hwaddr'                                                                                                                                            
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: hotpages.c:(.text+0x145): undefined reference to `qemu_plugin_hwaddr_is_io'                                                          
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: hotpages.c:(.text+0x184): undefined reference to `qemu_plugin_mem_is_store'                                                          
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: hotpages.c:(.text+0x1dd): undefined reference to `qemu_plugin_hwaddr_is_io'                                                          
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: hotpages.c:(.text+0x1ed): undefined reference to `qemu_plugin_hwaddr_device_offset'                                                  
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: tests/plugin/libhotpages.so.p/hotpages.c.o: in function `plugin_exit':                                                               
hotpages.c:(.text+0x2d5): undefined reference to `qemu_plugin_outs'                                                                                                                                                  
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: tests/plugin/libhotpages.so.p/hotpages.c.o: in function `qemu_plugin_install':                                                       
hotpages.c:(.text+0x395): undefined reference to `qemu_plugin_register_vcpu_tb_trans_cb'                                                                                                                             
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: hotpages.c:(.text+0x3a6): undefined reference to `qemu_plugin_register_atexit_cb'                                                    
make: *** [Makefile.ninja:2591: tests/plugin/libempty.so] Error 1                                                                                                                                                    
make: *** Waiting for unfinished jobs....                                                                                                                                                                            
collect2: error: ld returned 1 exit status                                                                                                                                                                           
make: *** [Makefile.ninja:2611: tests/plugin/libhotpages.so] Error 1           

[ebuild   R   ] app-emulation/qemu-9999  USE="-accessibility aio alsa bzip2 caps capstone curl -debug -doc fdt filecaps -glusterfs -gnutls gtk -infiniband io-uring -iscsi -jack% -jemalloc jpeg lzo -multipath ncurses nfs nls numa opengl oss pin-upstream-blobs plugins png pulseaudio python -rbd -sasl sdl -sdl-image* seccomp (-selinux) slirp -smartcard snappy spice ssh -static -static-user systemtap tci -test usb usbredir -vde vhost-net vhost-user-fs virgl virtfs vnc vte xattr xen -xfs xkb zstd" PYTHON_TARGETS="python3_6 python3_7 python3_8" QEMU_SOFTMMU_TARGETS="-aarch64 -alpha -arm -avr -cris -hppa -i386 -lm32 -m68k -microblaze -microblazeel -mips -mips64 -mips64el -mipsel -moxie -nios2 -or1k -ppc -ppc64 -riscv32 -riscv64 -rx -s390x -sh4 -sh4eb -sparc -sparc64 -tricore -unicore32 x86_64 -xtensa -xtensaeb" QEMU_USER_TARGETS="-aarch64 -aarch64_be -alpha -arm -armeb -cris -hppa -i386 -m68k -microblaze -microblazeel -mips -mips64 -mips64el -mipsel -mipsn32 -mipsn32el -nios2 -or1k -ppc -ppc64 -ppc64abi32 -ppc64le -riscv32 -riscv64 -s390x -sh4 -sh4eb -sparc -sparc32plus -sparc64 -tilegx -x86_64 -xtensa -xtensaeb" 

Reproducible: Always
Comment 1 Rafael Kitover 2020-09-07 08:10:42 UTC
Created attachment 658944 [details]
emerge --info
Comment 2 Rafael Kitover 2020-09-07 08:10:57 UTC
Created attachment 658946 [details]
build log
Comment 3 Sergei Trofimovich gentoo-dev 2020-09-08 22:37:39 UTC
Reproduce locally as well.
Comment 4 Sergei Trofimovich gentoo-dev 2020-09-10 07:01:39 UTC
(In reply to Rafael Kitover from comment #0)
> x86_64-pc-linux-gnu-gcc  -o tests/plugin/libempty.so
> tests/plugin/libempty.so.p/empty.c.o -Wl,--as-needed
> -Wl,--allow-shlib-undefined -shared -fPIC -Wl,--start-group
> -Wl,-soname,libempty.so -Wl,--warn-common -Wl,-
> z,relro -Wl,-z,now -m64 -fstack-protector-strong -fPIE -DPIE -std=gnu99
> -Wall -pie -Wl,-O1 -Wl,--as-needed -Wl,--export-dynamic -pthread
> -lgmodule-2.0 -lglib-2.0 -lglib-2.0 -Wl,--end-group                         
> x86_64-pc-linux-gnu-gcc  -o tests/plugin/libhotpages.so
> tests/plugin/libhotpages.so.p/hotpages.c.o -Wl,--as-needed
> -Wl,--allow-shlib-undefined -shared -fPIC -Wl,--start-group
> -Wl,-soname,libhotpages.so -Wl,--warn-
> common -Wl,-z,relro -Wl,-z,now -m64 -fstack-protector-strong -fPIE -DPIE
> -std=gnu99 -Wall -pie -Wl,-O1 -Wl,--as-needed -Wl,--export-dynamic -pthread
> -lgmodule-2.0 -lglib-2.0 -lglib-2.0 -Wl,--end-group             
> /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/
> ld: /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib64/Scrt1.o: in
> function `_start':                                             
> (.text+0x20): undefined reference to `main'                                 

The result should be a shared library with a few undefined symbols from plugin API. But for some reason the module is linked as an executable (regardless of -shared) and required main(). That is strange.

-pie linker flag for shared libs is a probable cause.
Comment 5 Sergei Trofimovich gentoo-dev 2020-09-13 08:46:59 UTC
One of workarounds should be to disable USE=-plugins until -pie passing gets sorted upstream.
Comment 6 Rafael Kitover 2020-09-18 23:47:31 UTC
Thank you, I get a successful build with -plugins.