InBetweenNames / gentooLTO

A Gentoo Portage configuration for building with -O3, Graphite, and LTO optimizations
GNU General Public License v2.0
571 stars 96 forks source link

libaio does not export io_getevents #314

Open tomtefan opened 5 years ago

tomtefan commented 5 years ago

Hi

I'm seeing: lvs: relocation error: lvs: symbol io_getevents version LIBAIO_0.4 not defined in file libaio.so.1 with link time reference

ld /lib64/libaio.so.1.0.1 ld: warning: cannot find entry symbol _start; not setting start address ld: /lib64/libaio.so.1.0.1: undefined reference to `io_getevents'

libaio builds fine but lvm2 does not: /usr/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/portage/sys-fs/lvm2-2.02.183/temp/lvm.ysMgri.ltrans2.ltrans.o: in function `_async_wait':

:(.text+0x596): undefined reference to `io_getevents' Re-adding the lto workaround for libaio solves the problem.
LowLeeWolf commented 5 years ago

Can confirm this on my system also.

InBetweenNames commented 5 years ago

It looks like certain symbols aren't appearing in the final libaio.so if LTO is in use:

With LTO:

0000000000000000      D  *UND*  0000000000000000              io_getevents
0000000000000000  w   D  *UND*  0000000000000000              _ITM_registerTMCloneTable
0000000000000000  w   D  *UND*  0000000000000000              _ITM_deregisterTMCloneTable
0000000000000000  w   D  *UND*  0000000000000000              __gmon_start__
0000000000000740 g    DF .text  000000000000003b  LIBAIO_0.4  io_destroy
00000000000008e0 g    DF .text  000000000000006a  LIBAIO_0.1  io_queue_init
00000000000008a0 g    DF .text  000000000000003b  LIBAIO_0.1  io_queue_release
00000000000007e0 g    DF .text  000000000000004f  LIBAIO_0.1  io_submit
0000000000000780 g    DF .text  000000000000004e  LIBAIO_0.4  io_setup
0000000000000840 g    DF .text  0000000000000059  LIBAIO_0.1  io_queue_run
0000000000000000 g    DO *ABS*  0000000000000000  LIBAIO_0.1  LIBAIO_0.1
0000000000000000 g    DO *ABS*  0000000000000000  LIBAIO_0.4  LIBAIO_0.4

Without:

0000000000000b60 g    DF .text  000000000000003b  LIBAIO_0.4  io_destroy
0000000000000aa0 g    DF .text  000000000000004f  LIBAIO_0.4  io_cancel
0000000000000bc0 g    DF .text  0000000000000029 (LIBAIO_0.1) io_queue_wait
0000000000000880 g    DF .text  000000000000000f  LIBAIO_0.4  io_queue_wait
0000000000000ba0 g    DF .text  0000000000000012 (LIBAIO_0.1) io_cancel
0000000000000840 g    DF .text  000000000000001e  LIBAIO_0.1  io_queue_init
0000000000000c00 g    DF .text  0000000000000034 (LIBAIO_0.1) io_getevents
0000000000000980 g    DF .text  00000000000000a3  LIBAIO_0.4  io_getevents
0000000000000860 g    DF .text  0000000000000006  LIBAIO_0.1  io_queue_release
0000000000000b00 g    DF .text  000000000000004e  LIBAIO_0.4  io_setup
0000000000000a40 g    DF .text  000000000000004f  LIBAIO_0.1  io_submit
00000000000008a0 g    DF .text  0000000000000059  LIBAIO_0.1  io_queue_run
0000000000000000 g    DO *ABS*  0000000000000000  LIBAIO_0.1  LIBAIO_0.1
0000000000000000 g    DO *ABS*  0000000000000000  LIBAIO_0.4  LIBAIO_0.4

I'll re-add the workaround with a comment linking this issue

pchome commented 4 years ago

459

With LTO and patched symver attribute:

0000000000001620 g    DF .text  0000000000000039  LIBAIO_0.1  io_queue_release
0000000000001380 g    DF .text  0000000000000039  LIBAIO_0.4  io_destroy
00000000000011c0 g    DF .text  000000000000004c (LIBAIO_0.1) io_queue_wait
0000000000001600 g    DF .text  000000000000000e  LIBAIO_0.4  io_queue_wait
0000000000001580 g    DF .text  0000000000000075  LIBAIO_0.1  io_queue_run
0000000000001420 g    DF .text  000000000000004d  LIBAIO_0.4  io_cancel
0000000000001180 g    DF .text  0000000000000036 (LIBAIO_0.1) io_cancel
0000000000001280 g    DF .text  00000000000000e3  LIBAIO_0.5  io_pgetevents
0000000000000000 g    DO *ABS*  0000000000000000  LIBAIO_0.1  LIBAIO_0.1
0000000000001660 g    DF .text  0000000000000062  LIBAIO_0.1  io_queue_init
0000000000000000 g    DO *ABS*  0000000000000000  LIBAIO_0.4  LIBAIO_0.4
0000000000000000 g    DO *ABS*  0000000000000000  LIBAIO_0.5  LIBAIO_0.5
00000000000013c0 g    DF .text  000000000000004c  LIBAIO_0.4  io_setup
00000000000014e0 g    DF .text  000000000000009c  LIBAIO_0.4  io_getevents
0000000000001220 g    DF .text  0000000000000057 (LIBAIO_0.1) io_getevents
0000000000001480 g    DF .text  000000000000004d  LIBAIO_0.1  io_submit