* [ltt-dev] [UST] Text relocations in 0.12
@ 2011-04-16 23:24 Jon Bernard
2011-04-19 1:18 ` Mathieu Desnoyers
0 siblings, 1 reply; 2+ messages in thread
From: Jon Bernard @ 2011-04-16 23:24 UTC (permalink / raw)
As I prepared the 0.12 release for Debian, I noticed that libust.so was
not PIC:
$ readelf -d libust/.libs/libust.so.0.0.0 | grep TEXTREL
0x0000000000000016 (TEXTREL) 0x0
Since all of the objects in libust are built with -fPIC, I thought
perhaps there was some assembly added between 0.11 and 0.12 that
contained text relocations. I bisected the two tags down to the
offending commit:
eb5d20c68aaf73661ffc02ba8fea3683c0358702
Within that commit, it seems to be a problem in include/ust/marker.h
with these lines:
@@ -129,7 +124,12 @@ struct marker {
[...]
+ /*".section __markers_ptrs\n\t"*/ \
+ ".section __markers_ptrs,\"a\", at progbits\n\t" \
If I make the __markers_ptrs section writable, with:
".section __markers_ptrs,\"aw\"\n\t
TEXTREL goes away and everything seems okay, tests pass. Is this
a correct solution? I don't understand why the section must be writable
to avoid relocations, can anyone explain?
Cheers
Jon
^ permalink raw reply [flat|nested] 2+ messages in thread* [ltt-dev] [UST] Text relocations in 0.12
2011-04-16 23:24 [ltt-dev] [UST] Text relocations in 0.12 Jon Bernard
@ 2011-04-19 1:18 ` Mathieu Desnoyers
0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Desnoyers @ 2011-04-19 1:18 UTC (permalink / raw)
* Jon Bernard (jbernard at debian.org) wrote:
> As I prepared the 0.12 release for Debian, I noticed that libust.so was
> not PIC:
>
> $ readelf -d libust/.libs/libust.so.0.0.0 | grep TEXTREL
> 0x0000000000000016 (TEXTREL) 0x0
>
> Since all of the objects in libust are built with -fPIC, I thought
> perhaps there was some assembly added between 0.11 and 0.12 that
> contained text relocations. I bisected the two tags down to the
> offending commit:
>
> eb5d20c68aaf73661ffc02ba8fea3683c0358702
>
> Within that commit, it seems to be a problem in include/ust/marker.h
> with these lines:
>
> @@ -129,7 +124,12 @@ struct marker {
> [...]
> + /*".section __markers_ptrs\n\t"*/ \
> + ".section __markers_ptrs,\"a\", at progbits\n\t" \
>
> If I make the __markers_ptrs section writable, with:
>
> ".section __markers_ptrs,\"aw\"\n\t
>
> TEXTREL goes away and everything seems okay, tests pass. Is this
> a correct solution? I don't understand why the section must be writable
> to avoid relocations, can anyone explain?
Oh.. I think I see. __markers_ptrs contains pointers to another section
that must be populated by the dynamic linker (thus at runtime). If the
section is read-only, the linker cannot update them at load time, so a
relocation table is probably needed.
I'll fix this in the git tree. It will be there in the next release.
Thanks!
Mathieu
>
> Cheers
>
> Jon
>
> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
>
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-04-19 1:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-16 23:24 [ltt-dev] [UST] Text relocations in 0.12 Jon Bernard
2011-04-19 1:18 ` Mathieu Desnoyers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox