Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Aug 2005 19:18:18 -0700
From:      <shellreef@gmail.com>
To:        tomstdenis@gmail.com, freebsd-amd64@freebsd.org
Subject:   [PATCH] LibTomCrypt on amd64 and -fPIC
Message-ID:  <e7ce49350508241918610b1f4c@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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 \



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e7ce49350508241918610b1f4c>