From owner-freebsd-arm@freebsd.org Sat Oct 7 20:15:23 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 CBA72E41329 for ; Sat, 7 Oct 2017 20:15:23 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x235.google.com (mail-it0-x235.google.com [IPv6:2607:f8b0:4001:c0b::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BAC036D7E0 for ; Sat, 7 Oct 2017 20:15:22 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x235.google.com with SMTP id 72so8465008itk.3 for ; Sat, 07 Oct 2017 13:15:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=7BdA9J4L3ACvPTPVoOgosPNUpwLFqJQBP7sJDMQBvlY=; b=ekRxZylnZsxj0cKW6aMt1ZjQw0vVzm/E2MqNSAjI1ueCWcd+bXGC+QrSAGr1P/vWge C7cvv/alR13ixwmEggjaxn7Jiwkx3em6I9MoNt3xhvpkCG3Jnx+c/M8/9DZWsvdJUIrY g1vcxuJF+77JZOwxCXETRUCH/QwieCU4Sg+9mpYkh21/ZRyRZyhG8Sg+jyTZPT7nnzI7 sfDJJ5OplbZtq0llzn8vwIYCgncMFrkhl3qPi0ZWyhiuOIhQkJKcsgA73hpjWW+RuQl7 XImxpG1AydekViWQ6bCeIgXWb1FQAqcdpHj7Whw0TaQWFknf44Fa5Buf6XbG+oDqr3/G kIXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=7BdA9J4L3ACvPTPVoOgosPNUpwLFqJQBP7sJDMQBvlY=; b=PDghvrx7kbOWAKequP5WXmDwNlIKSFmZWwPFDH/A5ZtGKlEtfMi4xpMuBe8jfkmVqG ZO5oYL4xihQ4/evweDAxcjF2yllXjlTkgyHSE7XbJAibRbLyR/E7IFUaVpKOYedSL1rQ 5kqlltTIHaNmbrZERDNt16sIwNuij0DfcPDZQDoXcFIyrdANSgrdTWt2HOiA3zpeTdj7 htyr36/w3YtOJnBwyHe86uMS3TWd3FFIl0LQL4sgL+rMcWruZAat0s7nXvRi9fxxF0fl 7dT92VAvmhaSqjBi4nSqSgVjKi+1j3MWdJT2xd0kryEP7t6QCk8RGiuegY6od883wtYz 0waw== X-Gm-Message-State: AMCzsaWY9Fdvb709QmBiFGJop8Fpog+blVQLW9+rrucyLIRO1e9b8M1z POh8RjLb2inM8dhkdwunn/0EHyGAIOKYnXmW1ivwQg== X-Google-Smtp-Source: AOwi7QAe82F6EaCYwg7R8tJfxfCLMnPo5MgEsqy/pwrUNHzoAz9ryA0U1+yAp6wgfVUyjVh3vuWgNB6ylJPwt8kWlJI= X-Received: by 10.36.19.207 with SMTP id 198mr7465019itz.130.1507407321901; Sat, 07 Oct 2017 13:15:21 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.94.130 with HTTP; Sat, 7 Oct 2017 13:15:21 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:43b:1393:6fda:6aaa] In-Reply-To: <1507403387.86205.286.camel@freebsd.org> References: <1507403387.86205.286.camel@freebsd.org> From: Warner Losh Date: Sat, 7 Oct 2017 13:15:21 -0700 X-Google-Sender-Auth: IxBy4c5Ua-aqox3FhxgM_M09kNE Message-ID: Subject: Re: armv7, building p7zip and -fPIC To: Ian Lepore Cc: Guy Yur , freebsd-arm Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 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 20:15:24 -0000 On Sat, Oct 7, 2017 at 12:09 PM, Ian Lepore wrote: > 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. > 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