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

Valery Ushakov uwe at stderr.spb.ru
Sat Feb 14 22:06:44 GMT 2015


[resent via gmane]

On Sat, Feb 14, 2015 at 18:00:54 +0000, Anna Fischer wrote:

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

As expected, that patch puts the object into wrong section.


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

Aha, that's interesting.  Without the patch g_kLdrRdrFileOps is in
.data.rel.ro.local in your build, so the file must have been compiled
PIC.  And looking at the full PLD build log linked from

  https://www.virtualbox.org/ticket/13199#comment:1

I see that out/linux.amd64/release/obj/RuntimeR3/common/ldr/ldrkStuff.o
is indeed built with -fPIC.  That file, part of RuntimeR3.a, is NOT
built as PIC in stock VBox build (RuntimeR3_TEMPLATE = VBoxR3Static).

If building it as PIC is not intended, than you should find the bug in
your makefiles or makefile patches that causes -fPIC to be added
there.  If building it as PIC *is* intended - you need to adjust that
visibility/mangling check to reflect the new reality.

HTH.

-uwe





More information about the vbox-dev mailing list