Thought about a Qt port
Thiago Macieira
thiago at macieira.org
Sun Mar 31 10:36:48 PDT 2013
On domingo, 31 de março de 2013 20.20.46, Alberto Mardegan wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 03/31/2013 12:11 AM, Thiago Macieira wrote:
> > Great. You'll need to query QtCore for "reduce_relocations":
> >
> > ifneq ($(shell $(PKGCONFIG) --variable qt_config $(QTCORE) | grep
> > reduce_relocations), )
> > CXXFLAGS += -fPIE endif
>
> Can you briefly explain (or just give a pointer to a web page) what
> this does? The gcc man page doesn't tell me much (other then I should
> probably add -pie to the linker flags; is this correct?).
QtCore.pc and Qt5Core.pc have a qt_config variable stored, which contains a
list of Qt settings that might be relevant for applications, such as what
features were enabled at compile time. The "reduce_relocations" feature
corresponds to the -reduce-relocations configure option.
On Qt 4, it was not enabled by default. In Qt 5, it is. And it produces an
error if you compile without -fPIE or -fPIC:
qglobal.h:974:4: error: #error "You must build your code with position
independent code if Qt was built with -reduce-relocations. " "Compile your
code with -fPIC or -fPIE."
Strictly speaking, what we need is to disable copy relocations in the
executable. There's no option for that, but -fPIC and -fPIE do accomplish it.
That also means you do not need to pass -pie to the linker.
For more information
http://www.macieira.org/blog/2012/01/sorry-state-of-dynamic-libraries-on-linux/
http://www.macieira.org/blog/2012/01/update-and-benchmark-on-the-dynamic-library-proposals/
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130331/ef761e60/attachment.sig>
More information about the subsurface
mailing list