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

Anna Fischer a.fischer at sirrix.com
Sat Feb 14 18:00:54 GMT 2015


> Betreff: Re: [vbox-dev] VBoxRT.so broken TEXTRELs since 4.3.16
> 
> 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

0000000000001510 g     F .text	0000000000000327 .hidden rtldrkLdrOpen
0000000000000000         *UND*	0000000000000000 RTMemAllocZTag
0000000000000260 g     O .rodata	0000000000000090 .hidden g_kLdrRdrFileOps
--
    15b1:	c7 00 19 09 61 19    	movl   $0x19610919,(%rax)
    15b7:	48 8d 05 00 00 00 00 	lea    0x0(%rip),%rax        # 15be <rtldrkLdrOpen+0xae>
			15ba: R_X86_64_PC32	g_kLdrRdrFileOps-0x4


> 
> 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

00000000000000c0 g     O .data.rel.ro.local	0000000000000090 .hidden g_kLdrRdrFileOps
			15ba: R_X86_64_PC32	g_kLdrRdrFileOps-0x4



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


00000000000000c0 D g_kLdrRdrFileOps


I have attached all outputs as text files as well.

Thanks for your help.

Anna
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nm-without-patch.log
Type: application/octet-stream
Size: 36 bytes
Desc: nm-without-patch.log
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20150214/76f8953f/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: objdump-without-patch.log
Type: application/octet-stream
Size: 130 bytes
Desc: objdump-without-patch.log
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20150214/76f8953f/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: objdump-with-patch.log
Type: application/octet-stream
Size: 402 bytes
Desc: objdump-with-patch.log
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20150214/76f8953f/attachment-0002.obj>


More information about the vbox-dev mailing list