Date: Fri, 19 Mar 2004 09:35:21 +0200 From: Ruslan Ermilov <ru@FreeBSD.org> To: Nakata Maho <chat95@mac.com> Cc: kris@obsecurity.org Subject: Re: -fPIC or -fpic? Message-ID: <20040319073521.GA18091@ip.net.ua> In-Reply-To: <20040319.142958.783378669.chat95@mac.com> References: <200403171047.i2HAlUsL048731@repoman.freebsd.org> <20040317111525.GA62305@xor.obsecurity.org> <20040317171904.GC93838@dragon.nuxi.com> <20040319.142958.783378669.chat95@mac.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On Fri, Mar 19, 2004 at 02:29:58PM +0900, Nakata Maho wrote:
> Dear all,
>
> obrien give me detailed explanation the difference
> -fpic and -fPIC (thanks!),
> however, as kris told me, we must test which is better.
> currently, it seems only for sparc64 -fPIC make sence,
> so, in /usr/share/mk/bsd.lib.mk, we find,
>
> .if !defined(PICFLAG)
> .if ${MACHINE_ARCH} == "sparc64"
> PICFLAG=-fPIC
> .else
> PICFLAG=-fpic
> .endif
> .endif
>
> this is a good choice.
>
> However, in the framework of ports, there's no way to do this since:
> % grep fPIC /usr/ports/Mk/bsd.*
> %
> % grep fpic /usr/ports/Mk/bsd.*
> %
>
> so I have to hardcode this, and I don't like to this.
> (see in math/atlas, math/atlas-devel, and biology/pymol)
>
> Otherwise, this patch (for example, math/atlas)
>
> @@ -49,13 +49,7 @@
> @(cd ${WRKSRC}; ${PATCH} < ${FILESDIR}/alpha-patch)
> .endif
>
> -.if !defined(PICFLAG)
> -.if ${MACHINE_ARCH} == "sparc64"
> -PICFLAG=-fPIC
> -.else
> -PICFLAG=-fpic
> -.endif
> -.endif
> +.include <bsd.lib.mk>
>
>
> doesn't help me
> % make
> Warning: Object directory not changed from original /home/maho/work/ports/math/atlas
>
> Note:
> at least amd64, in some cases, we need -fpic or -fPIC when we make
> shared libraries. some programs don't set such flag when compiling as you know.
> in i386, we don't need -fpic to make shared lib, so we force to make
> shared lib from static ones, so this can be a big problem.
> at least in the ports, we need PICFLAG definiton.
>
> putting this in bsd.port.mk
> .if !defined(PICFLAG)
> .if ${MACHINE_ARCH} == "sparc64"
> PICFLAG=-fPIC
> .else
> PICFLAG=-fpic
> .endif
> .endif
>
> is not a good idea at all, since it doesn't sync with bsd.lib.mk.
> splitting bsd.lib.mk to bsd.lib.pic.mk that contains only this,
> then include at bsd.port.mk might be a better idea, but still dirty.
>
> How do I do?
>
PICFLAG!= ${MAKE} -f bsd.lib.mk -V PICFLAG
Cheers,
--
Ruslan Ermilov
FreeBSD committer
ru@FreeBSD.org
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)
iD8DBQFAWqK5Ukv4P6juNwoRAqTXAJ4/YAIo/CWq6A0j3EEQDb6SgOyvWwCfWWGl
+u1PhOnjNMm8U3NG3Vxpkg0=
=xxcf
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040319073521.GA18091>
