From owner-freebsd-amd64@FreeBSD.ORG Thu Aug 25 02:18:19 2005 Return-Path: X-Original-To: freebsd-amd64@freebsd.org Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C4B0916A41F for ; Thu, 25 Aug 2005 02:18:19 +0000 (GMT) (envelope-from shellreef@gmail.com) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.206]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5E4D843D49 for ; Thu, 25 Aug 2005 02:18:19 +0000 (GMT) (envelope-from shellreef@gmail.com) Received: by rproxy.gmail.com with SMTP id i8so213384rne for ; Wed, 24 Aug 2005 19:18:18 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=l6szt3aPq3IlO1+SadowURiobi64F8Pq7bqesV/epxqxHeko5EgsZHIuB/8KV3+N9d+fqADhX0cJrd4ihXBAQORAW/pnYflSZKnhpN9o1cIHkfDGlRvq95X/luLThv5/sTBmEmi1FK68YTosCWIihaXt0OZX5/yy5DAbsld8MaQ= Received: by 10.38.209.25 with SMTP id h25mr318629rng; Wed, 24 Aug 2005 19:18:18 -0700 (PDT) Received: by 10.38.89.2 with HTTP; Wed, 24 Aug 2005 19:18:18 -0700 (PDT) Message-ID: Date: Wed, 24 Aug 2005 19:18:18 -0700 From: To: tomstdenis@gmail.com, freebsd-amd64@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Cc: Subject: [PATCH] LibTomCrypt on amd64 and -fPIC X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: shellreef+freebsd@gmail.com List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Aug 2005 02:18:19 -0000 Tom, (also sending to freebsd-amd64 mailing list) I am on this platform: FreeBSD 5.4-STABLE FreeBSD 5.4-STABLE #0: Sat Aug 20 13:42:23 PDT 2005 amd= 64 and received this error message when linking to LibTomCrypt: ld: /usr/local/lib/libtomcrypt.a(aes.o): relocation R_X86_64_32S can not be used when making a shared object; recompile with -fPIC So I recompiled with -fPIC, and it worked as expected. Would it be a good idea to add -fPIC to CFLAGS in the gcc makefile in the main LTC distribution? The gcc info page says that -fPIC emits position-independent code "if supported for the target machine", so if I'm reading it correctly, it seems that adding this option shouldn't affect platforms that don't support -fPIC. An alternative would be to add a patch in the FreeBSD Ports Tree, if it is not acceptable to add -fPIC to the mainline LibTomCrypt distribution (patch attached). http://64.233.187.104/search?q=3Dcache:rXPUY4O_QlgJ:pvrguide.no-ip.com/bbs-= old/viewtopic/12079.html+R_X86_64_32S+can+not+be+used+when+making+a+shared+= object&hl=3Den&start=3D2D suggests adding CFLAGS=3D-fPIC to /etc/make.conf so it is used system-wide: >AFAIK, AMD64 pretty much across the board requires you to inject -fPIC >into every compilation. Probably wouldn't be a bad thing to add to the >build system. To FreeBSD-amd64: Can we add -fPIC to make.conf? Are there any side-effects? (I'd prefer this as I use packages and would prefer to not compile from ports.) To Tom: Would you accept this patch into LTC or should it be an OS-specific patch? Thanks, -Jeff Connelly =3D=3Dltc.patch (apply in /usr/ports/security/libtomcrypt/work/*/) =3D=3D --- makefile.orig Wed Aug 24 17:39:15 2005 +++ makefile Wed Aug 24 17:39:36 2005 @@ -15,7 +15,7 @@ #ARFLAGS=3Dr =20 # Compilation flags. Note the +=3D does not write over the user's CFLAGS! -CFLAGS +=3D -c -I./testprof/ -I./src/headers/ -Wall -Wsign-compare -W -Wshadow -Wno-unused-parameter -DLTC_SOURCE +CFLAGS +=3D -c -I./testprof/ -I./src/headers/ -Wall -Wsign-compare -W -Wshadow -Wno-unused-parameter -DLTC_SOURCE -fPIC =20 # additional warnings (newer GCC 3.4 and higher) #CFLAGS +=3D -Wsystem-headers -Wdeclaration-after-statement -Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wmissing-prototypes \