[vbox-dev] VBoxRT.so broken TEXTRELs since 4.3.16

Valery Ushakov uwe at stderr.spb.ru
Fri Feb 13 21:16:48 GMT 2015

Anna Fischer wrote:

>> actually it's not the -nopie parameter but the following patch:
>> 008_virtualbox-4.3.14-missing_define.patch
>>   https://bugs.gentoo.org/514658
>>   https://www.virtualbox.org/ticket/13199
>>   --- VirtualBox-4.3.14/src/VBox/Runtime/common/ldr/ldrkStuff.cpp
>>   +++ VirtualBox-4.3.14/src/VBox/Runtime/common/ldr/ldrkStuff.cpp
>>   @@ -368,7 +368,7 @@
>>     * We provide our own based on IPRT instead of using the kLdr ones.
>>     */
>>    extern "C" const KRDROPS g_kLdrRdrFileOps;
>>   -extern "C" const KRDROPS g_kLdrRdrFileOps =
>>   +const KRDROPS g_kLdrRdrFileOps __attribute__((section(".rodata"))) =
>>    {
>>        /* .pszName = */        "IPRT",
>>        /* .pNext = */          NULL,
>> I don't know why this patch is required but the result is that
>> there will be a new small ".rodata" section with "aw" bits defined.
>> I don't know why this patch is necessary at all, maybe specific to
>> the other Gentoo patches.
>> You can try to
>> 1) remove that patch at all. If that doesn't compile, do you see the same
>>    problem as in the above mentioned ticket 13199? 
> Yes, I get the same compiler error. I cannot compile without that patch.
>> If that doesn't work,
>>    try to
>> 2) remove the section(".rodata") attribute. Does that work?
> No that doesn't seem to work. I still get the compiler error without
> that attribute.

1) What does the following command print

$ objdump -xdr out/linux.amd64/release/obj/VBoxRT/common/ldr/ldrkStuff.o | grep -B2 g_kLdrRdrFileOps

for the build *with* the .rodata patch?  This is the file that is
linked into VBoxRT.so and causes the complaint about the relocation.

For me with stock VBox the symbol is in .data.rel.ro.local and is
hidden.  When VBoxRT.so is linked, the relocation in text is resolved
to the hidden symbol and the output has no relocation for that symbol.

2) *Without* that patch that adds explicit .rodata, what does

$ objdump -xdr out/linux.amd64/release/obj/RuntimeR3/common/ldr/ldrkStuff.o | grep g_kLdrRdrFileOps


nm out/linux.amd64/release-/lib/RuntimeR3.a | grep -i g_kLdrRdrFileOps
0000000000000440 R g_kLdrRdrFileOps


This is the same file compiled in a different place that caused the
original problems in ticket 13199.

For me g_kLdrRdrFileOps is already in .rodata and is hidden; and nm
reports it as "R".

Note that the nm | sed check that fails for you is sifting nm output
for '/^[TUDB] /', so in your build g_kLdrRdrFileOps ends up in data
section for some reason, I'd guess.  That's also what explicit .rodata
patch addresses here.  It also breaks things for VBoxRT.so above since
in *that* case g_kLdrRdrFileOps shouldn't be in rodata, obviously.


More information about the vbox-dev mailing list