https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87698

            Bug ID: 87698
           Summary: [lto] Shared library build with -ffat-lto-objects
                    generates extra global absolute symbol relocations
           Product: gcc
           Version: 8.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: romain.geissler at amadeus dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Hi,

Is it expected that a shared library where each .o file has been built with
-flto -ffat-lto-objects has more symbol relocation (absolute symbol
relocations) than the very same shared library built with -flto
-ffat-lto-objects ?

With gcc 8.2.1 20181011 I have the following symbols defined in the case of fat
lto objects when building libssh2 (https://github.com/libssh2/libssh2):

/opt/1A/toolchain/x86_64-2.6.32-v4/bin/readelf -a
~combld/delivery/continuous/components.osp/osp/SSH2/18-0-0-0/lib/x86_64-2.6.32-v4/Debug/libssh2.so|grep
ABS
   138: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_session_set_bloc
   142: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_store_str
   143: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_sha1_init
   149: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_list_next
   152: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_comp_methods 
   154: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_ntohu64
   155: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_init_aes_ctr 
   159: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_dsa_sha1_verify
   163: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_list_first  
   168: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_base64_encode
   170: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_rsa_new_private_
   172: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_pub_priv_keyfile
   178: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_channel_locate
   179: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_kex_exchange 
   186: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_transport_read
   187: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_channel_extended
   188: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_channel_read 
   191: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_rsa_sha1_verify
   194: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_packet_burn 
   198: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_ntohu32
   200: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_userauth_publick
   203: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_channel_receive_
   204: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_dsa_new_private_
   205: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_pub_priv_keyfile
   206: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_dsa_sha1_sign
   209: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_channel_free 
   215: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_list_init
   217: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_channel_write
   223: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_htonu32
   224: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_channel_close
   228: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_send
   230: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_channel_forward_
   232: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_dsa_new_private
   235: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_sha256_init 
   236: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_recv
   245: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_md5_init
   247: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_packet_requirev
   250: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_channel_process_
   251: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_packet_require
   260: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_list_add
   264: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_wait_socket 
   265: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_packet_ask  
   267: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_cipher_init
   271: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_rsa_sha1_sign
   272: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_error_flags
   273: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_rsa_new_private
   275: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_dsa_new
   282: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_error
   285: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_cipher_crypt
   290: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_store_u32
   294: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_channel_open
   298: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_packet_add
   299: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_init_if_needed
   300: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_transport_send
   301: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_calloc
   302: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_channel_packet_d
   303: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_rsa_new
   306: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS
_libssh2_channel_nextid
   309: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_mac_methods
   310: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS _libssh2_list_remove
    33: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS crtstuff.c
    41: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS
   337: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS crtstuff.c 
   339: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS
  4605: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS

The -fno-fat-lto-objects case gives:

/opt/1A/toolchain/x86_64-2.6.32-v4/bin/readelf -a .libs/libssh2.so|grep ABS    
             1:02AM     34: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS
crtstuff.c
    42: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS 
   343: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS crtstuff.c
   345: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS 
   973: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS

Also the final libssh2.so file size seems a bit different:
 - fat objects: 656K
 - slim objects: 596K

Is it expected that -ffat-lto-objects leaks data into shared library too ?

Cheers,
Romain

Reply via email to