Re: Building Extension on Linux fails with relocation error

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Building Extension on Linux fails with relocation error
Date: 2023-12-22 17:29:56
Message-ID: 1067412.1703266196@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Peter J. Holzer" <hjp-pgsql(at)hjp(dot)at> writes:
> On 2023-12-22 10:31:14 -0500, Tom Lane wrote:
>> Binaek Sarkar <binaek(at)turbot(dot)com> writes:
>>> Interestingly, the *build completes successfully when the .a file is
>>> smaller* (around 100 MB).

>> Pure luck I suspect.

> I seem to remember a 256MB limit for position independent code on x86.
> The current man-page for GCC doesn't mention such a limit, though, so I
> may be mistaken.

At least on x86, there is/was a shlib size boundary beyond which you
needed to generate different instructions with wider offset fields
in order to have position-independent code. Thus the difference
between -fpic and -fPIC. It's at least possible that the OP's Go
toolchain automatically uses -fpic, but I'm suspicious of that theory.
Usually you don't use either switch when building .a libraries.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Wilma Wantren 2023-12-22 23:09:56 Re: Re: Changing a schema's name with function1 calling function2
Previous Message Peter J. Holzer 2023-12-22 16:52:11 Re: Building Extension on Linux fails with relocation error