RE: [Bluez-devel] Alignment issue

David Woodhouse
2004-08-13T11:52:36Z

On Fri, 2004-08-13 at 11:05 +0200, Marcel Holtmann wrote:
> > You also need -fpic in CFLAGS, I believe.
>
> if this is true, then this makes your patch useless.

I was overriding CFLAGS when I invoked make, because otherwise other
stuff (like -m32) gets omitted. Can we do this in acinclude.m4?

- CFLAGS="-Wall -O2"
+ if (test "${CFLAGS}" = ""); then
+ CFLAGS="-Wall -O2"
+ fi
+

> However after doing some research in this area it seems that I must
> use -fPIE and then link with -pie. This actually only works for
> programs, because libtool don't uses these extra flags.

You can also use -fpic instead of -fPIE, apparently.

> Check out the CVS. The patch for that is already included.

OK. I think I'm not supposed to ship a cvs snapshot -- I have to wait
for 2.10. But I've isolated just the patch in question and added it into
the bluez-utils-2.9-2 RPM, with the above change to inherit CFLAGS if
they're already set.

The SRPM and ppc build are already at
ftp://ftp.uk.linux.org/pub/people/dwmw2/fc2-mac/ and the builds for
other less interesting architectures will turn up in rawhide in the
morning.

> > > What is the best way to detect PIE support in the compiler?
> >
> > I hate myself for saying it, but possibly just test whether you can
> > actually build an executable that way?
>
> I did it this way, but there were reports of Sparc platforms where the
> resulting binary should be run-tested.

Hmmm. Can I revise my original answer.... don't. If the user asks for
it, do it. Else don't.

Random behavioural changes based on the characteristics of the system we
_happen_ to build on today are probably a bad thing. Just build as
configured and don't try to auto-adapt to _anything_ :)

--
dwmw2