From owner-freebsd-arm@freebsd.org Sat Oct 7 19:09:57 2017 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C97AE3F839 for ; Sat, 7 Oct 2017 19:09:57 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from pmta2.delivery6.ore.mailhop.org (pmta2.delivery6.ore.mailhop.org [54.200.129.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CF4228307C for ; Sat, 7 Oct 2017 19:09:56 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 03ff8b6b-ab93-11e7-b50b-53dc5ecda239 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound2.ore.mailhop.org (Halon) with ESMTPSA id 03ff8b6b-ab93-11e7-b50b-53dc5ecda239; Sat, 07 Oct 2017 19:09:17 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id v97J9lOB008939; Sat, 7 Oct 2017 13:09:47 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1507403387.86205.286.camel@freebsd.org> Subject: Re: armv7, building p7zip and -fPIC From: Ian Lepore To: Guy Yur , Warner Losh Cc: freebsd-arm Date: Sat, 07 Oct 2017 13:09:47 -0600 In-Reply-To: References: Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Oct 2017 19:09:57 -0000 On Sat, 2017-10-07 at 21:59 +0300, Guy Yur wrote: > On 7 October 2017 at 21:40, Warner Losh wrote: > > > > > > > > On Sat, Oct 7, 2017 at 11:24 AM, Guy Yur wrote: > > > > > > > > > Hi, > > > > > > Does armv7 need -fPIC when compiling? > > > > > > Building archivers/p7zip fails with: > > > /usr/bin/ld: 7zEncode.o(.text+0x2d04): unresolvable R_ARM_MOVW_ABS_NC > > > relocation against symbol `_ZTIi@@CXXABI_1.3' > > > /usr/bin/ld: final link failed: Nonrepresentable section on output > > > c++: error: linker command failed with exit code 1 (use -v to see > > > invocation) > > > *** [../../../../bin/7z.so] Error code 1 > > > > > > make[3]: stopped in > > > > > > /usr/wrkdir/usr/ports/archivers/p7zip/work/p7zip_16.02/CPP/7zip/Bundles/Format7zFree > > > 1 error > > > > > > If I add "CFLAGS_armv7= -fPIC" in the port Makefile it builds fine. > > > The port has -fPIC for aarch64, amd64, powerpc and sparc64. > > > > > > Is it a difference from armv6? > > > When I previously built for armv6 it worked without the option. > > > > armv7 is new in FreeBSD (two days old), and maybe you are tripping over > > something inside the port that optimized for it? Is there a > > CFLAGS+armv6=-fPIC? I don't see it with a quick grep, but you never know... > > If that's what it takes to fix it, maybe you should submit that to the port > > maintainer? > > > > Warner > Hi, > > Seems to indeed be a difference between armv6 and armv7, > found this: https://bugs.launchpad.net/ubuntu/+source/gcc-4.4/+bug/503448 > > I will submit a patch to the port maintainer to add CFLAGS for armv7. > > Thanks, > Guy This is really not just an armv7-only thing, the -fPIC flag should always be used.  On armv6 (and some other non-arm arches) it will accidentally work without that flag, but that doesn't make it right. --- Ian