We get below error with few executables compiled on AIX 7.3 using gcc/g++
root@bp2-aixlpar-om-aix73 # bin/pdconfig Could not load program bin/pdconfig: Relocation failed for /test/rahul/otos/lib/libotds.1.so because: Relocation entry 0 (at address 0x4BD43) has an invalid l_rsecnm field. Relocation entry 1 (at address 0x4BD43) has an invalid l_rsecnm field. Relocation entry 2 (at address 0x4ECD3) has an invalid l_rsecnm field. Relocation entry 3 (at address 0x4ECD3) has an invalid l_rsecnm field. Relocation entry 4 (at address 0x4F643) has an invalid l_rsecnm field. Relocation entry 5 (at address 0x4F643) has an invalid l_rsecnm field. Relocation entry 6 (at address 0x4FD63) has an invalid l_rsecnm field. Relocation entry 7 (at address 0x4FD63) has an invalid l_rsecnm field. Relocation entry 8 (at address 0x50443) has an invalid l_rsecnm field. Relocation entry 9 (at address 0x50443) has an invalid l_rsecnm field. Relocation entry 10 (at address 0x50B43) has an invalid l_rsecnm field. Relocation entry 11 (at address 0x50B43) has an invalid l_rsecnm field. Relocation entry 12 (at address 0x516D3) has an invalid l_rsecnm field. Relocation entry 13 (at address 0x516D3) has an invalid l_rsecnm field. Relocation entry 14 (at address 0x52473) has an invalid l_rsecnm field. Relocation entry 15 (at address 0x52473) has an invalid l_rsecnm field. Relocation entry 16 (at address 0x52A53) has an invalid l_rsecnm field. Relocation entry 17 (at address 0x52A53) has an invalid l_rsecnm field. Relocation entry 18 (at address 0x531C3) has an invalid l_rsecnm field. Relocation entry 19 (at address 0x531C3) has an invalid l_rsecnm field. Relocation entry 20 (at address 0x543C3) has an invalid l_rsecnm field. Relocation entry 21 (at address 0x543C3) has an invalid l_rsecnm field. Relocation entry 22 (at address 0x55663) has an invalid l_rsecnm field. Relocation entry 23 (at address 0x55663) has an invalid l_rsecnm field. Relocation entry 24 (at address 0x58093) has an invalid l_rsecnm field. Relocation entry 25 (at address 0x58093) has an invalid l_rsecnm field. Examine .loader section relocation entries with the 'dump -Rv' command.
root@bp2-aixlpar-om-aix73 # g++ --version gcc (GCC) 10.3.0 Copyright (C) 2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
root@bp2-aixlpar-om-aix73 # uname -a AIX bp2-aixlpar-om-aix73 3 7 00C4D5F04B00
We use below commands to compile the libraries
g++ -Wl,-brtl -maix64 -fPIC -DUSE_EXP_BUF -DAIX -I/eng/otbuild/aix73/os/24.2.0.0.0.good/exports/include/ -c -o AuthOTDS.o AuthOTDS.cpp g++ -Wl,-brtl -maix64 -fPIC -DUSE_EXP_BUF -DAIX -I/eng/otbuild/aix73/os/24.2.0.0.0.good/exports/include/ -c -o Helpers.o Helpers.cpp g++ -Wl,-brtl -maix64 -fPIC -DUSE_EXP_BUF -DAIX -I/eng/otbuild/aix73/os/24.2.0.0.0.good/exports/include/ -c -o OTDSConnector.o OTDSConnector.cpp g++ -Wl,-brtl -maix64 -fPIC -DUSE_EXP_BUF -DAIX -I/eng/otbuild/aix73/os/24.2.0.0.0.good/exports/include/ -c -o UserGroupOpOTDS.o UserGroupOpOTDS.cpp g++ -Wl,-brtl -maix64 -fPIC -DUSE_EXP_BUF -DAIX -I/eng/otbuild/aix73/os/24.2.0.0.0.good/exports/include/ -c -o UserOpOTDS.o UserOpOTDS.cpp g++ -Wl,-brtl -maix64 -fPIC -DUSE_EXP_BUF -DAIX -I/eng/otbuild/aix73/os/24.2.0.0.0.good/exports/include/ -c -o Connection.o Connection.cpp g++ -Wl,-brtl -maix64 -fPIC -DUSE_EXP_BUF -DAIX -I/eng/otbuild/aix73/os/24.2.0.0.0.good/exports/include/ -c -o JsonUtil.o JsonUtil.cpp g++ -Wl,-brtl -maix64 -fPIC -DUSE_EXP_BUF -DAIX -I/eng/otbuild/aix73/os/24.2.0.0.0.good/exports/include/ -c -o RestClient.o RestClient.cpp g++ -Wl,-brtl -maix64 -fPIC -DUSE_EXP_BUF -DAIX -I/eng/otbuild/aix73/os/24.2.0.0.0.good/exports/include/ -c -o OTDSConfig.o OTDSConfig.cpp g++ -Wl,-brtl -maix64 -fPIC -DUSE_EXP_BUF -DAIX -I/eng/otbuild/aix73/os/24.2.0.0.0.good/exports/include/ -c -o AppOrigin.o AppOrigin.cpp g++ -Wl,-brtl -maix64 -fPIC -DUSE_EXP_BUF -DAIX -I/eng/otbuild/aix73/os/24.2.0.0.0.good/exports/include/ -c -o RestClientWrapper.o RestClientWrapper.cpp g++ -Wl,-brtl -maix64 -fPIC -DUSE_EXP_BUF -DAIX -I/eng/otbuild/aix73/os/24.2.0.0.0.good/exports/include/ -c -o OTDSConnectorWrapper.o OTDSConnectorWrapper.cpp g++ -Wl,-brtl -maix64 -fPIC -DUSE_EXP_BUF -DAIX -I/eng/otbuild/aix73/os/24.2.0.0.0.good/exports/include/ -c -o OcpOTDS.o OcpOTDS.cpp
ld -bshared -bnotextro -o libotds.1.so cat libotds.1.lst -b64 -G -bnoentry -bnolibpath -bnoipath -bexpall -bE:libotds.1.exp -L/eng/otbuild/aix73/os/24.2.0.0.0.good/exports/lib -lcurl -lC -lc_r
libotds.1.so is linked to another library libms.2.so. Below command is used to build this library
ld -bshared -o libms.2.so cat libms.2.lst -b64 -G -bnoentry -bnolibpath -bnoipath -bexpall -bE:libms.2.exp -L/eng/otbuild/aix73/os/24.2.0.0.0.good/exports/lib /eng/otbuild/aix73/os/24.2.0.0.0.good/exports/lib/libotds.1.so -lc_r
libms.2.so ultimately gets linked to the executables (ex. pdconfig)
Below are the dependencies bash-4.3# ldd lib/libotds.1.so lib/libotds.1.so needs: /test/rahul/otos/lib/libcurl.so /usr/lib/libc_r.a(shr_64.o) /opt/freeware/lib/libgcc_s.a(shr.o) /test/rahul/otos/lib/libcryptootom.a(libcryptootom64.so.3) /usr/lib/libc.a(shr_64.o) /test/rahul/otos/lib/libsslotom.a(libsslotom64.so.3) /unix /usr/lib/libcrypt.a(shr_64.o) /usr/lib/libpthreads.a(shr_xpg5_64.o)
bash-4.3# ldd lib/libms.2.so lib/libms.2.so needs: /test/rahul/otos/lib/libotds.1.so /usr/lib/libc_r.a(shr_64.o) /test/rahul/otos/lib/libcurl.so /unix /usr/lib/libcrypt.a(shr_64.o) /opt/freeware/lib/libgcc_s.a(shr.o) /test/rahul/otos/lib/libcryptootom.a(libcryptootom64.so.3) /usr/lib/libc.a(shr_64.o) /test/rahul/otos/lib/libsslotom.a(libsslotom64.so.3) /usr/lib/libpthreads.a(shr_xpg5_64.o)
bash-4.3# ldd bin/pdconfig bin/pdconfig needs: /test/rahul/otos/lib/libcurl.so /test/rahul/otos/lib/libdazelObject.2.so /test/rahul/otos/lib/libms.2.so /test/rahul/otos/lib/libdazeldb.3.so /test/rahul/otos/lib/Drivers/lib/libodbc.a(odbc.so) /test/rahul/otos/lib/libsnmp_abs.2.so /test/rahul/otos/lib/libsgml.2.so /test/rahul/otos/lib/libutility.2.so /test/rahul/otos/lib/libserver_utils.3.so /test/rahul/otos/lib/libserver_pdb.2.so /test/rahul/otos/lib/libidsapi.3.so /test/rahul/otos/lib/libidscommon.3.so /test/rahul/otos/lib/libxmlutils.2.so /test/rahul/otos/lib/libxml2.so /test/rahul/otos/lib/libauthz.2.so /test/rahul/otos/lib/libauthzcommon.2.so /test/rahul/otos/lib/libQS.2.so /test/rahul/otos/lib/libinc.3.so /test/rahul/otos/lib/libdazel.3.so /test/rahul/otos/lib/libasn1cebuf.2.so /test/rahul/otos/lib/libsnmp.so /test/rahul/otos/lib/libathread.1.so /usr/lib/libpthreads.a(shr_xpg5_64.o) /usr/lib/libc_r.a(shr_64.o) /opt/freeware/lib/libgcc_s.a(shr.o) /test/rahul/otos/lib/libcryptootom.a(libcryptootom64.so.3) /usr/lib/libc.a(shr_64.o) /test/rahul/otos/lib/libsslotom.a(libsslotom64.so.3) /test/rahul/otos/lib/libotds.1.so /usr/lib/libC.a(ansi_64.o) /test/rahul/otos/lib/Drivers/lib/libddicu28.a(ddicu28.so) /test/rahul/otos/lib/Drivers/lib/libodbcinst.a(odbcinst.so) /usr/lib/libC.a(shr_64.o) /usr/lib/libpthread.a(shr_xpg5_64.o) /usr/lib/libiconv.a(shr4_64.o) /test/rahul/otos/lib/libjson-c.so /unix /usr/lib/libcrypt.a(shr_64.o) /usr/lib/libC.a(shrcore_64.o) /usr/lib/libC.a(ansicore_64.o) /usr/lib/libC.a(shr2_64.o)
We have been using xlC to compile the same code on AIX 7.1. Now we are trying to use gcc/g++ to compile it