public inbox for [email protected]  
help / color / mirror / Atom feed
From: Srirama Kucherlapati <[email protected]>
To: Heikki Linnakangas <[email protected]>
To: Heikki Linnakangas <[email protected]>
To: Tom Lane <[email protected]>
Cc: Peter Eisentraut <[email protected]>
Cc: Alvaro Herrera <[email protected]>
Cc: [email protected] <[email protected]>
Cc: Laurenz Albe <[email protected]>
Cc: Noah Misch <[email protected]>
Cc: Michael Paquier <[email protected]>
Cc: Andres Freund <[email protected]>
Cc: Thomas Munro <[email protected]>
Cc: [email protected] <[email protected]>
Cc: [email protected] <[email protected]>
Cc: Bruce Momjian <[email protected]>
Subject: RE: AIX support
Date: Tue, 17 Sep 2024 16:29:01 +0000
Message-ID: <CY8PR15MB5602561E7BF438A1B6C5371BDB612@CY8PR15MB5602.namprd15.prod.outlook.com> (raw)
In-Reply-To: <DS0PR15MB5623ECC0499C5087EFD729EADB652@DS0PR15MB5623.namprd15.prod.outlook.com>
References: <CY5PR11MB639218D04CFAED0FC09ED9DFFDED2@CY5PR11MB6392.namprd11.prod.outlook.com>
	<[email protected]>
	<CY8PR15MB5602AA47C13A33DBF68BEA73DBFB2@CY8PR15MB5602.namprd15.prod.outlook.com>
	<[email protected]>
	<CY8PR15MB56029161FE37A1DE9DE36B70DBC72@CY8PR15MB5602.namprd15.prod.outlook.com>
	<CY8PR15MB5602CAFFE00371049D68CD25DBCD2@CY8PR15MB5602.namprd15.prod.outlook.com>
	<[email protected]>
	<CY8PR15MB560282A99569E110AEED3257DBCF2@CY8PR15MB5602.namprd15.prod.outlook.com>
	<CY8PR15MB56029A55A848E9089D29FBE6DBC92@CY8PR15MB5602.namprd15.prod.outlook.com>
	<CY8PR15MB5602C6D2B148615EBD7F1AF5DB872@CY8PR15MB5602.namprd15.prod.outlook.com>
	<[email protected]>
	<CY8PR15MB5602A5D9064A401347684A06DB872@CY8PR15MB5602.namprd15.prod.outlook.com>
	<[email protected]>
	<CY8PR15MB5602B407BBD1B7B7C5FF1D8CDB9B2@CY8PR15MB5602.namprd15.prod.outlook.com>
	<[email protected]>
	<DS0PR15MB5623ECC0499C5087EFD729EADB652@DS0PR15MB5623.namprd15.prod.outlook.com>

    > Do you still need mkldexport.sh? Surely there's a better way to do that
    > in year 2024. Some quick googling says there's a '-bexpall' option to
    > 'ld', which kind of sounds like what we want. Will that work? How do
    > other programs do this?

We have noticed couple of caveats with these flags -bexpall/-bexpfull in other
opensource tools on AIX.  This option would export too many symbols causing
problems because a shared library may re-export symbols from another library
causing confused dependencies, duplicate symbols.




We have similar discussion wrt to these flag in Cmake

    https://gitlab.kitware.com/cmake/cmake/-/issues/19163





Also, I tried some sample program to verify the same as below



    >> cat foo.c

        #include <stdio.h>

        #include <string.h>

        int func1()

        {

            char str1[] = "Hello ", str2[] = "world! ";

            strcat(str1,str2);

            puts(str1);

            return 0;

        }



    >> gcc -c foo.c -o foo.o

    >> gcc -shared -Wl,-bexpall -o foo.so foo.o

    >> dump -Tov foo.so



    foo.so:



                            ***Object Module Header***

    # Sections      Symbol Ptr      # Symbols       Opt Hdr Len     Flags

             4      0x00000d88            120                72     0x3002

    Flags=( EXEC DYNLOAD SHROBJ DEP_SYSTEM )

    Timestamp = "Sep 17 10:17:35 2024"

    Magic = 0x1df  (32-bit XCOFF)



                            ***Optional Header***

    Tsize       Dsize       Bsize       Tstart      Dstart

    0x00000548  0x0000010c  0x00000004  0x10000128  0x20000670



    SNloader    SNentry     SNtext      SNtoc       SNdata

    0x0004      0x0000      0x0001      0x0002      0x0002



    TXTalign    DATAalign   TOC         vstamp      entry

    0x0005      0x0004      0x20000750  0x0001      0xffffffff



    maxSTACK    maxDATA     SNbss       magic       modtype

    0x00000000  0x00000000  0x0003      0x010b        RE



                            ***Loader Section***



                            ***Loader Symbol Table Information***

    [Index]      Value      Scn     IMEX Sclass   Type           IMPid Name



    [0]     0x2000068c    .data              RW SECdef        [noIMid] __rtinit

    [1]     0x00000000    undef      IMP     DS EXTref libgcc_s.a(shr.o) __cxa_finalize

    [2]     0x00000000    undef      IMP     DS EXTref libgcc_s.a(shr.o) _GLOBAL__AIXI_shr_o

    [3]     0x00000000    undef      IMP     DS EXTref libgcc_s.a(shr.o) _GLOBAL__AIXD_shr_o

    [4]     0x00000000    undef      IMP     DS EXTref   libc.a(shr.o) __strtollmax

    [5]     0x00000000    undef      IMP     DS EXTref   libc.a(shr.o) puts

    [6]     0x200006f4    .data      EXP     DS   Ldef        [noIMid] __init_aix_libgcc_cxa_atexit

    [7]     0x20000724    .data      EXP     DS   Ldef        [noIMid] _GLOBAL__AIXI_foo_so

    [8]     0x20000730    .data      EXP     DS   Ldef        [noIMid] _GLOBAL__AIXD_foo_so

>>    [9]     0x2000073c    .data      EXP     DS SECdef        [noIMid] strcat

    [10]    0x20000744    .data      EXP     DS   Ldef        [noIMid] func1



The code makes use of strcat from libc but re-exports the symbol (because of -bexpall).





As of now due to the limitation with these flags (-bexpall / -bexpfull ? ), the

solution here is to continue to extract the symbols from the object files and

use that export file as part of building the shared library. (Continue to use

the mkldexport.sh script to generate the export symbols).



Thanks,
Sriram.




view thread (20+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: RE: AIX support
  In-Reply-To: <CY8PR15MB5602561E7BF438A1B6C5371BDB612@CY8PR15MB5602.namprd15.prod.outlook.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox