RE: AIX: Symbols are missing in libpq.a

From: "REIX, Tony" <tony(dot)reix(at)atos(dot)net>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: RE: AIX: Symbols are missing in libpq.a
Date: 2021-08-30 14:33:32
Message-ID: PR3PR02MB63969DF2C172EE7A1222624386CB9@PR3PR02MB6396.eurprd02.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Noah,

It appears that the Makefile in src/interfaces/libpq has been modified between v12 and v13, removing encnames.o (and wchar.o) from the object files being used for creating the static libpq.a file which is used for creating the libpq.so and libpq.a AIX shared-library files.
And, since pg_encoding_to_char() is defined in encnames.o , it has disappeared from the libpq.exp file .

# diff postgresql-12.8/32bit/src/interfaces/libpq/Makefile postgresql-13.1/32bit/src/interfaces/libpq/Makefile | grep encnames
< OBJS += encnames.o wchar.o
< encnames.c wchar.c: % : $(backend_src)/utils/mb/%
< rm -f encnames.c wchar.c

Remember how the final libpq.a is built on AIX:

rm -f libpq.a
/usr/bin/ar crs libpq.a fe-auth-scram.o ...
touch libpq.a
../../../src/backend/port/aix/mkldexport.sh libpq.a libpq.so.5 >libpq.exp
/opt/freeware/bin/gcc -maix64 -O3 ..... -o libpq.so.5 libpq.a -Wl,-bE:libpq.exp .......
rm -f libpq.a
/usr/bin/ar crs libpq.a libpq.so.5

12.8 : /usr/bin/ar crs libpq.a fe-auth.o fe-auth-scram.o fe-connect.o fe-exec.o fe-lobj.o fe-misc.o fe-print.o fe-protocol2.o fe-protocol3.o
pqexpbuffer.o fe-secure.o legacy-pqsignal.o libpq-events.o encnames.o wchar.o fe-secure-openssl.o fe-secure-common.o

13.1 : /usr/bin/ar crs libpq.a fe-auth.o fe-auth-scram.o fe-connect.o fe-exec.o fe-lobj.o fe-misc.o fe-print.o fe-protocol2.o fe-protocol3.o
pqexpbuffer.o fe-secure.o legacy-pqsignal.o libpq-events.o fe-secure-common.o fe-secure-openssl.o

Maybe you can discover why these changes were made in v13 for src/interfaces/libpq/Makefile .
And mkldexport.sh , unchanged between v12 and v13, works perfectly.

Regards/Cordialement,

Tony Reix

tony(dot)reix(at)atos(dot)net

ATOS / Bull SAS
ATOS Expert
IBM-Bull Cooperation Project: Architect & OpenSource Technical Leader
1, rue de Provence - 38432 ECHIROLLES - FRANCE
www.atos.net<https://mail.ad.bull.net/owa/redir.aspx?C=PvphmPvCZkGrAgHVnWGsdMcDKgzl_dEIsM6rX0g4u4v8V81YffzBGkWrtQeAXNovd3ttkJL8JIc.&URL=http%3a%2f%2fwww.atos.net%2f>
________________________________
De : Noah Misch <noah(at)leadboat(dot)com>
Envoyé : dimanche 29 août 2021 17:46
À : REIX, Tony <tony(dot)reix(at)atos(dot)net>
Cc : pgsql-hackers(at)lists(dot)postgresql(dot)org <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Objet : Re: AIX: Symbols are missing in libpq.a

Caution! External email. Do not open attachments or click links, unless this email comes from a known sender and you know the content is safe.

On Thu, Aug 26, 2021 at 12:49:01PM +0000, REIX, Tony wrote:
> While porting postgresql-odbc v13 to AIX, we have found that (at least) 2 symbols are missing in libpq.a provided by the port of PostgreSQL v13.1 to AIX 7.1 by the BullFreeware project :
>
> pg_char_to_encoding
> pg_encoding_to_char
>
> Looking at details, it appears that these symbols are present in version 12.8 .
> They were still missing in 13.4 .
> Something has changed between v12 and v13.
>
> Looking at more details, the way libpq.a is built on AIX is different from the way libpq.so is built on Linux.
> On Linux, the file "exports.txt" is used for building the list of symbols to be exported.
> On AIX, the tool mkldexport.sh is used for dynamically generating the symbols to be exported.
> And it appears that 5 symbols (including the 2 above) are missing on AIX. Don't know why.

Would you study why it changed? If $(MKLDEXPORT) is no longer able to find
all symbols, then we're likely to have problems in more libraries than libpq,
including libraries that don't use a $(SHLIB_EXPORTS) file.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2021-08-30 14:36:30 Re: Fix around conn_duration in pgbench
Previous Message Denis Smirnov 2021-08-30 14:26:09 Re: Async-unsafe functions in signal handlers