Date: Sat, 7 Oct 2017 13:15:21 -0700 From: Warner Losh <imp@bsdimp.com> To: Ian Lepore <ian@freebsd.org> Cc: Guy Yur <guyyur@gmail.com>, freebsd-arm <freebsd-arm@freebsd.org> Subject: Re: armv7, building p7zip and -fPIC Message-ID: <CANCZdfpd=E5D03F2CXprYCqS-ghRHhnocYJna7UnB-5vdJDwDg@mail.gmail.com> In-Reply-To: <1507403387.86205.286.camel@freebsd.org> References: <CAC67Hz8kctZyTEW%2B0qQRVYLzPEK7cG9JXhw90fwHx84fnuwO0w@mail.gmail.com> <CANCZdfo-1ngKQSkkW5zjZwMWj0QnVnrf2WaJ68=bh_oNPKZ3hw@mail.gmail.com> <CAC67Hz8RxH%2BNd0dPbn4qstpFJEkoFWkKpTQ81sX6K3NUuYPDtA@mail.gmail.com> <1507403387.86205.286.camel@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Oct 7, 2017 at 12:09 PM, Ian Lepore <ian@freebsd.org> wrote: > On Sat, 2017-10-07 at 21:59 +0300, Guy Yur wrote: > > On 7 October 2017 at 21:40, Warner Losh <imp@bsdimp.com> wrote: > > > > > > > > > > > > On Sat, Oct 7, 2017 at 11:24 AM, Guy Yur <guyyur@gmail.com> 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. > I've emailed the maintainer asking to apply this: diff --git a/archivers/p7zip/Makefile b/archivers/p7zip/Makefile index 9e2c2a21deec..1bf32ccd39ac 100644 --- a/archivers/p7zip/Makefile +++ b/archivers/p7zip/Makefile @@ -20,6 +20,8 @@ MAKEFILE= makefile MAKE_ARGS= OPTFLAGS="${CXXFLAGS}" WRKSRC= ${WRKDIR}/${PORTNAME}_${PORTVERSION} +CFLAGS_arm= -fPIC +CFLAGS_armv6= -fPIC CFLAGS_armv7= -fPIC CFLAGS_aarch64= -fPIC CFLAGS_amd64= -fPIC Warner
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfpd=E5D03F2CXprYCqS-ghRHhnocYJna7UnB-5vdJDwDg>