Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rGjLf-00GqD4-3c for pgsql-general@arkaria.postgresql.org; Fri, 22 Dec 2023 17:30:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rGjLd-009QMD-CL for pgsql-general@arkaria.postgresql.org; Fri, 22 Dec 2023 17:30:09 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rGjLd-009QJ6-12 for pgsql-general@lists.postgresql.org; Fri, 22 Dec 2023 17:30:09 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rGjLa-00BhPw-Hw for pgsql-general@lists.postgresql.org; Fri, 22 Dec 2023 17:30:07 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 3BMHTu7e1067413; Fri, 22 Dec 2023 12:29:56 -0500 From: Tom Lane To: "Peter J. Holzer" cc: pgsql-general@lists.postgresql.org Subject: Re: Building Extension on Linux fails with relocation error In-reply-to: <20231222165211.btdrstuwkileiyzh@hjp.at> References: <1054188.1703259074@sss.pgh.pa.us> <20231222165211.btdrstuwkileiyzh@hjp.at> Comments: In-reply-to "Peter J. Holzer" message dated "Fri, 22 Dec 2023 17:52:11 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1067411.1703266196.1@sss.pgh.pa.us> Date: Fri, 22 Dec 2023 12:29:56 -0500 Message-ID: <1067412.1703266196@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "Peter J. Holzer" writes: > On 2023-12-22 10:31:14 -0500, Tom Lane wrote: >> Binaek Sarkar 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