From: Christoph Berg <myon@debian.org>
To: Andres Freund <andres@anarazel.de>
To: Jason Petersen <jason@citusdata.com>
To: pgsql-pkg-debian@postgresql.org, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: [PATCH] relocation truncated to fit: citus build failure on s390x
Date: Mon, 29 May 2017 17:58:50 +0200
Message-ID: <20170529155850.qojdfrwkkqnjb3ap@msg.df7cb.de> (raw)
In-Reply-To: <20160428080824.GA22412@msg.df7cb.de>
References: <A37C3A5E-DDEA-40C9-BB67-133B42E4E0A8@citusdata.com>
<980D4281-A01F-4F5D-9874-FFED701F403F@citusdata.com>
<20160426151339.GF12563@msg.df7cb.de>
<20160426153235.GA2862@msg.df7cb.de>
<20160427230516.44fuzdxlifch2wwp@alap3.anarazel.de>
<20160428080824.GA22412@msg.df7cb.de>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Re: To Andres Freund 2016-04-28 <20160428080824.GA22412@msg.df7cb.de>
> > I'm not clear why citus triggers this, when other extensions don't?
>
> Maybe it's simply because citus.so is bigger than all the other
> extension .so files:
>
> -fpic
> Generate position-independent code (PIC) suitable for use
> in a shared library, if supported for the target machine.
> Such code accesses all constant addresses through a global
> offset table (GOT). The dynamic loader resolves the GOT
> entries when the program starts (the dynamic loader is not
> part of GCC; it is part of the operating system). If the
> GOT size for the linked executable exceeds a machine-
> specific maximum size, you get an error message from the
> linker indicating that -fpic does not work; in that case,
> recompile with -fPIC instead. (These maximums are 8k on
> the SPARC and 32k on the m68k and RS/6000. The 386 has no
> such limit.)
>
> Position-independent code requires special support, and
> therefore works only on certain machines. For the 386, GCC
> supports PIC for System V but not for the Sun 386i. Code
> generated for the IBM RS/6000 is always
> position-independent.
>
> When this flag is set, the macros "__pic__" and "__PIC__"
> are defined to 1.
>
> -fPIC
> If supported for the target machine, emit
> position-independent code, suitable for dynamic linking and
> avoiding any limit on the size of the global offset table.
> This option makes a difference on the m68k, PowerPC and
> SPARC.
>
> Position-independent code requires special support, and
> therefore works only on certain machines.
>
> When this flag is set, the macros "__pic__" and "__PIC__"
> are defined to 2.
>
> This doesn't mention s390(x), but citus.so 382952 bytes (on amd64) is
> well beyond the 8k/32k limits mentioned above.
>
> PostgreSQL itself links correctly on s390x:
> ... -I/usr/include/mit-krb5 -fPIC -pie -I../../../../src/include
>
> I'm not an expert in compiler flags, but it seems to me CFLAGS_SL is
> wrong on s390(x) in Makefile.port, it should use -fPIC like sparc.
After talking to a s390x Debian porter, -fPIC is the correct flag to
use. The quoted patch made the previously failing builds for citus and
pglogical (which have larger-than-average .so files) on s390x succeed
(and the sparc64 case still works):
--- a/src/makefiles/Makefile.linux+++ b/src/makefiles/Makefile.linux@@ -5,7 +5,8 @@ export_dynamic = -Wl,-E
rpath = -Wl,-rpath,'$(rpathdir)',--enable-new-dtags
DLSUFFIX = .so
-ifeq "$(findstring sparc,$(host_cpu))" "sparc"+# Enable -fPIC to avoid "relocation truncated to fit" linker errors+ifneq "$(filter sparc% s390%,$(host_cpu))" ""
CFLAGS_SL = -fPIC
else
CFLAGS_SL = -fpic
The patch was made against 9.6; I'd opt to include it in master and
the back branches.
https://buildd.debian.org/status/logs.php?pkg=citus&arch=s390xhttps://buildd.debian.org/status/logs.php?pkg=pglogical&arch=s390x
Christoph
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
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: pgsql-pkg-debian@postgresql.org
Cc: myon@debian.org, andres@anarazel.de, jason@citusdata.com, pgsql-hackers@postgresql.org
Subject: Re: [PATCH] relocation truncated to fit: citus build failure on s390x
In-Reply-To: <20170529155850.qojdfrwkkqnjb3ap@msg.df7cb.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox