GNU bug report logs - #23531
C++ shared library breaks with "-pie -fpie" and libtool

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: libtool; Reported by: manuel.bachmann@HIDDEN; dated Fri, 13 May 2016 16:14:02 UTC; Maintainer for libtool is bug-libtool@HIDDEN.

Message received at 23531 <at> debbugs.gnu.org:


Received: (at 23531) by debbugs.gnu.org; 14 May 2016 15:27:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 14 11:27:39 2016
Received: from localhost ([127.0.0.1]:51567 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1b1bTf-0007g9-4R
	for submit <at> debbugs.gnu.org; Sat, 14 May 2016 11:27:39 -0400
Received: from mail-yw0-f196.google.com ([209.85.161.196]:36629)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mbc@HIDDEN>) id 1b1bTd-0007fw-0l
 for 23531 <at> debbugs.gnu.org; Sat, 14 May 2016 11:27:37 -0400
Received: by mail-yw0-f196.google.com with SMTP id u62so14392527ywe.3
 for <23531 <at> debbugs.gnu.org>; Sat, 14 May 2016 08:27:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=koumoul.net; s=dkim;
 h=mime-version:reply-to:sender:in-reply-to:references:date:message-id
 :subject:from:to;
 bh=Sw1M3Nb2STr3eA9fPFe1haRVw7HMCdqoVCphJioBHv0=;
 b=G7U+/g3/ves9fRVJyIcktt7zNR8007MAwl8/2Hm6vRS787oK52MjNYARHibI9s9k07
 Q4qWSjGpqZ7SS/NYTx2DkPxpsrptxyg2xUw4xnBWnn/eJnYxtc5OjcEWKd3cb1KxCfDu
 un0ToAjI2Efgf5cny6DOrWmIthc9rGKpiKedU=
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=iot-bzh.20150623.gappssmtp.com; s=20150623;
 h=mime-version:reply-to:sender:in-reply-to:references:date:message-id
 :subject:from:to;
 bh=Sw1M3Nb2STr3eA9fPFe1haRVw7HMCdqoVCphJioBHv0=;
 b=X5/8ZROlBkeFvc8LTR4Jl1bjXbe2YfqC9JhxT7zLH34Kxcfe0g+1EtDvL2gVVjQW+H
 KIKuQ5wVcXb+5HOp3fm3zRqol7ge9ArGuD6mXt76DyG6Zd7djsKh+txlcNvTMqBjdCo9
 vDpfzZnQXAruE8tUdwHaQ9IlU2zGQJ/zD9z6qOCQz6NYuCFhp3VgWxo9qlRp42czpRog
 nns7mRbNlt41cJZVqtJzCkJUCrzA0277ycSCYXO+JHPZ5/xk6KTPGkvRwsRDs5KLmaMk
 FjbA0MxqDzaBUYVu24eH18wUyxNWazIFa2z/SjVMwVqAlNQCVWW+59NOlUe/86QGXMAt
 fgQA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:mime-version:reply-to:sender:in-reply-to
 :references:date:message-id:subject:from:to;
 bh=Sw1M3Nb2STr3eA9fPFe1haRVw7HMCdqoVCphJioBHv0=;
 b=fZgyBRcuNBXUAdbAE1+KH7XY0AT/MMmTubXI+Y8nipFEMbZrWIZYM8E9SRdRJHSIW4
 NfoIkS0aKGO0oSk3jKGC4QY7hWRf8tJfD+1rN/McGlhnb5NNpN1rfjh6kOkYo4Eo/aEl
 HO9SkIfIOKXoctZn2GfoRL5TMmqOGYZ6kJ3MGFrmVzm5I6Z92qYeZDoR4uMcuQT88HFQ
 x9V7S8xjji2sSumYJeepcy3Ci4WTFUaUaZgd7xug2IKx/+apDrWyNwo460A6m10UVd/y
 +Qdb1RLezQ53S/UzUR6R7+WDVO6iumFKiAGXapZGxiczKjYt/Gqr7v1IGuZ91p+VM+y3
 BGHg==
X-Gm-Message-State: AOPr4FV1yGRTXuEKsSGLXLYgqxYa0d3YQPDOmLCANMoBTPANjTdq35BCyrLUHK03l9DjjVhAAmE2/Zye9e5RyA==
MIME-Version: 1.0
X-Received: by 10.37.114.3 with SMTP id n3mr10122124ybc.158.1463239651244;
 Sat, 14 May 2016 08:27:31 -0700 (PDT)
Received: by 10.13.217.149 with HTTP; Sat, 14 May 2016 08:27:31 -0700 (PDT)
X-Originating-IP: [89.81.60.108]
In-Reply-To: <20160513183023.GU26300@HIDDEN>
References: <CANTDXNf7ZYJLWxc5tosjuBnJXA70j59OXRbFHKM-e_otw3adog@HIDDEN>
 <20160513183023.GU26300@HIDDEN>
Date: Sat, 14 May 2016 17:27:31 +0200
X-Google-Sender-Auth: WGdrR7F0sIMTQ4keOXR30EHlBYk
Message-ID: <CANTDXNfJw3+K_U03=mntcBrBSEK1DhbuToe=iC2ohTa2j8Lriw@HIDDEN>
Subject: Re: bug#23531: C++ shared library breaks with "-pie -fpie" and libtool
From: Manuel Bachmann <manuel.bachmann@HIDDEN>
To: Manuel Bachmann <manuel.bachmann@HIDDEN>, 23531 <at> debbugs.gnu.org
Content-Type: text/plain; charset=UTF-8
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 23531
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: manuel.bachmann@HIDDEN
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

Hi Mike,

Thanks a lot for the feedback ! So I better fix the build system (in
this case, the Yocto one) first. Will take a look at libtool itself,
but later.
Regards,
Manuel Bachmann, Graphics & Multimedia Engineer
www.iot.bzh



2016-05-13 20:30 GMT+02:00 Mike Frysinger <vapier@HIDDEN>:
> On 13 May 2016 14:04, Manuel Bachmann wrote:
>> I am building a C++ project [1] with libtool ; this project contains a
>> shared library.
>>
>> Since recently, and as I am building with the Yocto project, I am
>> required to build with GCC security enforcement options ([2], see
>> SECURITY_FLAGS line).
>> It basically adds the following flags in CFLAGS and CXXFLAGS : "-pie -fpie"
>>
>> This makes the build break on x86_64 with the following message (ARM
>> has a similar one) :
>>
>> /usr/lib64/libc_nonshared.a(elf-init.oS): In function `__libc_csu_init':
>> (.text+0x14): undefined reference to `__init_array_start'
>> /bin/ld: /usr/lib64/libc_nonshared.a(elf-init.oS): relocation
>> R_X86_64_PC32 against undefined hidden symbol `__init_array_start' can
>> not be used when making a shared object
>>
>> Removing the "-pie" flag, alone, makes the build succeed.
>>
>> I was told that "-pie" flag is reserved for executables, not shared
>> libraries or modules. But build logs [3] show that libtool is
>> propagating both "-pie -fpie" flags in all steps, but the final linker
>> step.
>> Is this a libtool bug, not removing "-pie" in this case ? Or should we
>> not include "-pie" in our CFLAGS in the first place ?
>
> currently, i'd say it's a bug in your build to add -pie/-fPIE when trying
> to produce shared libs.
>
> however, i think it's worthwhile to expand libtool to produce PIE objects
> like it does with PIC/non-PIC.  then it should be able to gather inputs
> correctly to produce shared libs (PIC/non-PIE) the same time as programs
> (PIE).  whether that'll happen any time soon though ... :)
> -mike




Information forwarded to bug-libtool@HIDDEN:
bug#23531; Package libtool. Full text available.

Message received at 23531 <at> debbugs.gnu.org:


Received: (at 23531) by debbugs.gnu.org; 13 May 2016 18:30:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 13 14:30:33 2016
Received: from localhost ([127.0.0.1]:50218 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1b1Hr6-0003kz-Rf
	for submit <at> debbugs.gnu.org; Fri, 13 May 2016 14:30:33 -0400
Received: from smtp.gentoo.org ([140.211.166.183]:43498)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <vapier@HIDDEN>) id 1b1Hr4-0003kh-P5
 for 23531 <at> debbugs.gnu.org; Fri, 13 May 2016 14:30:31 -0400
Received: from vapier.lan (localhost [127.0.0.1])
 by smtp.gentoo.org (Postfix) with SMTP id 015A13407B8;
 Fri, 13 May 2016 18:30:23 +0000 (UTC)
Date: Fri, 13 May 2016 14:30:23 -0400
From: Mike Frysinger <vapier@HIDDEN>
To: Manuel Bachmann <manuel.bachmann@HIDDEN>
Subject: Re: bug#23531: C++ shared library breaks with "-pie -fpie" and libtool
Message-ID: <20160513183023.GU26300@HIDDEN>
Mail-Followup-To: Manuel Bachmann <manuel.bachmann@HIDDEN>,
 23531 <at> debbugs.gnu.org
References: <CANTDXNf7ZYJLWxc5tosjuBnJXA70j59OXRbFHKM-e_otw3adog@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature"; boundary="MO4t1VgQTCtsHhID"
Content-Disposition: inline
In-Reply-To: <CANTDXNf7ZYJLWxc5tosjuBnJXA70j59OXRbFHKM-e_otw3adog@HIDDEN>
X-Spam-Score: -6.4 (------)
X-Debbugs-Envelope-To: 23531
Cc: 23531 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -6.4 (------)


--MO4t1VgQTCtsHhID
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 13 May 2016 14:04, Manuel Bachmann wrote:
> I am building a C++ project [1] with libtool ; this project contains a
> shared library.
>=20
> Since recently, and as I am building with the Yocto project, I am
> required to build with GCC security enforcement options ([2], see
> SECURITY_FLAGS line).
> It basically adds the following flags in CFLAGS and CXXFLAGS : "-pie -fpi=
e"
>=20
> This makes the build break on x86_64 with the following message (ARM
> has a similar one) :
>=20
> /usr/lib64/libc_nonshared.a(elf-init.oS): In function `__libc_csu_init':
> (.text+0x14): undefined reference to `__init_array_start'
> /bin/ld: /usr/lib64/libc_nonshared.a(elf-init.oS): relocation
> R_X86_64_PC32 against undefined hidden symbol `__init_array_start' can
> not be used when making a shared object
>=20
> Removing the "-pie" flag, alone, makes the build succeed.
>=20
> I was told that "-pie" flag is reserved for executables, not shared
> libraries or modules. But build logs [3] show that libtool is
> propagating both "-pie -fpie" flags in all steps, but the final linker
> step.
> Is this a libtool bug, not removing "-pie" in this case ? Or should we
> not include "-pie" in our CFLAGS in the first place ?

currently, i'd say it's a bug in your build to add -pie/-fPIE when trying
to produce shared libs.

however, i think it's worthwhile to expand libtool to produce PIE objects
like it does with PIC/non-PIC.  then it should be able to gather inputs
correctly to produce shared libs (PIC/non-PIE) the same time as programs
(PIE).  whether that'll happen any time soon though ... :)
-mike

--MO4t1VgQTCtsHhID
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJXNh0/AAoJEEFjO5/oN/WB4loQAIHvGzcNVdgD2bIUUDHXM+nf
CX2ftnw65f94cMaBMsCvnMtG9G88Bi7UAJm9Xw2lckSjzQibCB/JTUV+WVmKxmoU
3EQyKOKymrtTlwIy1jPtOuujKAxrMtO90xGMZWFMrJ07eLQHGfoNeJp0zmGEK0LD
4lV/M1G6TmopJUZFNYqyxisigNt0QZx1Iz1AefXJOYhT2P7AjFf+mRvWR4RZI17g
/p2y293tgG5zHYgA8Kjjrk1PLqK7G0oA0ZXC3MEiNIPgqG3myg2snkYtYi/B4cZ1
BavWHBj97nAPBy7fEDQhoVDe1zAyGMOlryBUisdxwLzFReSyOi0RzJ0Uf8qMSsQH
UAwKQEPmPm6O67NolbN0XERq8Ajk12yj/9xS3RE9NwPqhzuc+WsJwYxvf1QMfBJI
FtaUi5UAzar0G/AHdGymC3SE3qyNjgXjRCks23DVlor91cBjrwPvOR0bb7Uz+bvV
TQdlCqNJeOog/1LWNGzccTb0M22tqzykHl+4WhNEBMvnAz/A2Hz9VGBwC7yrtv0Z
ebqzftH8RIQRE7lhEwXSO9vYzIRiFtyNSc+vKWZsOST/UjLJYdLpzgSr6XVCi2Ie
HmsoS1aZ/Xr8vPrnJsHB54RxNE4PPpdbCwRxSU4Lrw+ptuOsIb2ttpSfdxbT5oP/
ZYGGdph31N3vPyuTgm9/
=S9sm
-----END PGP SIGNATURE-----

--MO4t1VgQTCtsHhID--




Information forwarded to bug-libtool@HIDDEN:
bug#23531; Package libtool. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 13 May 2016 16:13:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 13 12:13:56 2016
Received: from localhost ([127.0.0.1]:50134 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1b1Fit-0006tc-9L
	for submit <at> debbugs.gnu.org; Fri, 13 May 2016 12:13:56 -0400
Received: from eggs.gnu.org ([208.118.235.92]:42388)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mbc@HIDDEN>) id 1b1BpP-0000ps-HR
 for submit <at> debbugs.gnu.org; Fri, 13 May 2016 08:04:24 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <mbc@HIDDEN>) id 1b1BpF-00089e-Ov
 for submit <at> debbugs.gnu.org; Fri, 13 May 2016 08:04:18 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_DKIM_INVALID
 autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:46430)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mbc@HIDDEN>) id 1b1BpF-00089M-LU
 for submit <at> debbugs.gnu.org; Fri, 13 May 2016 08:04:13 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:33341)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mbc@HIDDEN>) id 1b1Bp8-0004V4-Ol
 for bug-libtool@HIDDEN; Fri, 13 May 2016 08:04:12 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <mbc@HIDDEN>) id 1b1Bp3-00088C-TX
 for bug-libtool@HIDDEN; Fri, 13 May 2016 08:04:05 -0400
Received: from mail-yw0-x243.google.com ([2607:f8b0:4002:c05::243]:33728)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mbc@HIDDEN>) id 1b1Bp3-000885-L0
 for bug-libtool@HIDDEN; Fri, 13 May 2016 08:04:01 -0400
Received: by mail-yw0-x243.google.com with SMTP id y6so10895420ywe.0
 for <bug-libtool@HIDDEN>; Fri, 13 May 2016 05:04:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=koumoul.net; s=dkim;
 h=mime-version:reply-to:sender:date:message-id:subject:from:to;
 bh=PuQ0JQlcpLqp4QzrrJJeljjlUAHnp57yxkTGm6ph5DM=;
 b=kxm/xuhXWY/aezYnlFmgGQtgd3Kedu35fUQbN4I9waXRdIkwmMIhYrT8zivYUZAa+Y
 9HLr66tSvj5BWwClgt+5hahC/yp22P05E/dX/thy4j/okE51aUISO7Yh/1Fi2NDhxF3V
 5Gpl/IyOjiqse2v0AW+5y9sZilI6GDiI0yTW8=
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=iot-bzh.20150623.gappssmtp.com; s=20150623;
 h=mime-version:reply-to:sender:date:message-id:subject:from:to;
 bh=PuQ0JQlcpLqp4QzrrJJeljjlUAHnp57yxkTGm6ph5DM=;
 b=A2U8gJOERmH5xsQlOFJwvSwm1sXzkTmGL9iSkrAKNjc+OYBToRbFEiSXKET2+HogPZ
 R3KIM+xaBSMg2O053p0KNv66Rnfx0aTu5fuz8CN24nxzR98HGnNXAk1+h6g1Vn/Sw2+p
 NPEhCgjpv/aoV9nuL4KFlgH/sG6kqRtXjh9RK2OOOi8fVAfMoRfoVzrXuQokBjEgzasO
 L0in7D1pEZcfIHft/hpQP9AQgpAVcUQFjU+HClPewtl5ktgdyJHnTKqvbIkdYTequdG1
 32hVXJbckUlMfDjTmj6bfr4D/XWvQFqOayD7a/GvgGYuUg2Tdka/ewb5zXKXSG/rkhw9
 QrnQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:mime-version:reply-to:sender:date:message-id
 :subject:from:to;
 bh=PuQ0JQlcpLqp4QzrrJJeljjlUAHnp57yxkTGm6ph5DM=;
 b=XFCBezDeHtYbLlwrzcaex8uWPsJineV+TkK2ehLk162AJi7XVC4BR68v6tYyucyeWe
 8X37oBfdN5QUOOFhQsWw3HGd9rI5/i/1zIK8VBuYvjU6fJ+nznh1gbMbLwuBePMht4KI
 7WBlTdSAp1AkSKe5V1UnihRkjk30Y6HMz7QUwRvWr/XfgWFIXpX9z/+510zZeM2v9Kl3
 AV5QnI+jsh9+07Mv+64avb8vjuXNtczN4eFH9LTsGQ6CpqfaVvNS64iCmThJWIUbQ5SZ
 hjZJpA2y4y4QgWKb2xFHbB9al0YiRuNW1onKWDGBUOqdbxDX63dwncnEg2/kAZOrdLYg
 qf9Q==
X-Gm-Message-State: AOPr4FXxZc6BhVphxBmuX/2Il8XNG/0ZEF3U9PWrWbU6Z92f9a33vJtj70VcR/ve7Tr450l/nJw8ITne8TlXnA==
MIME-Version: 1.0
X-Received: by 10.129.138.199 with SMTP id a190mr6983199ywg.21.1463141040679; 
 Fri, 13 May 2016 05:04:00 -0700 (PDT)
Received: by 10.13.217.149 with HTTP; Fri, 13 May 2016 05:04:00 -0700 (PDT)
X-Originating-IP: [86.253.108.95]
Date: Fri, 13 May 2016 14:04:00 +0200
X-Google-Sender-Auth: mcMpG4qprf8KWnPweDLbJwD1Rcg
Message-ID: <CANTDXNf7ZYJLWxc5tosjuBnJXA70j59OXRbFHKM-e_otw3adog@HIDDEN>
Subject: C++ shared library breaks with "-pie -fpie" and libtool
From: Manuel Bachmann <manuel.bachmann@HIDDEN>
To: bug-libtool@HIDDEN
Content-Type: text/plain; charset=UTF-8
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Fri, 13 May 2016 12:13:54 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: manuel.bachmann@HIDDEN
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

Hi folks,

I am building a C++ project [1] with libtool ; this project contains a
shared library.

Since recently, and as I am building with the Yocto project, I am
required to build with GCC security enforcement options ([2], see
SECURITY_FLAGS line).
It basically adds the following flags in CFLAGS and CXXFLAGS : "-pie -fpie"

This makes the build break on x86_64 with the following message (ARM
has a similar one) :

/usr/lib64/libc_nonshared.a(elf-init.oS): In function `__libc_csu_init':
(.text+0x14): undefined reference to `__init_array_start'
/bin/ld: /usr/lib64/libc_nonshared.a(elf-init.oS): relocation
R_X86_64_PC32 against undefined hidden symbol `__init_array_start' can
not be used when making a shared object

Removing the "-pie" flag, alone, makes the build succeed.

I was told that "-pie" flag is reserved for executables, not shared
libraries or modules. But build logs [3] show that libtool is
propagating both "-pie -fpie" flags in all steps, but the final linker
step.
Is this a libtool bug, not removing "-pie" in this case ? Or should we
not include "-pie" in our CFLAGS in the first place ?

Thanks for any advice !

[1] : https://github.com/iotbzh/qml_radio_plugin
[2] : https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/conf/distro/include/security_flags.inc
[3] : http://hastebin.com/onerixofop.md
[4]: https://github.com/iotbzh/qml_radio_plugin/blob/master/Makefile.am

Regards,
Manuel Bachmann, Graphics & Multimedia Engineer
www.iot.bzh




Acknowledgement sent to manuel.bachmann@HIDDEN:
New bug report received and forwarded. Copy sent to bug-libtool@HIDDEN. Full text available.
Report forwarded to bug-libtool@HIDDEN:
bug#23531; Package libtool. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.