More questions about _GLOBAL

Adam Megacz gcj@lists.megacz.com
Wed Jan 30 15:58:00 GMT 2002


Anthony Green <green@redhat.com> writes:
> One idea is to create a special "ignored" class which
> _Jv_RegisterClass is taught to ignore, and then use linker tricks to
> alias foo.bar.baz.class$ to the ignored class.

Do you know what linker tricks I should use?
The main problem I've run into is that the relocation that writes the
address of the class$ variable into the __GLOBAL_ section is a
file-local relocation. The relocation that writes the address of the
__GLOBAL into the .ctors section is also a file-local reloc.
According to the binutils gurus:
Adam> Is there any way to get the first behavior (0x0) when stripping
Adam> file-local symbols?
Ian Lance Taylor> What happens when you do this is processor and
Ian Lance Taylor> object file format dependent. The fact that you get
Ian Lance Taylor> a zero in some cases is a coincidence. The fact
Ian Lance Taylor> that you get the address of the start of the section
Ian Lance Taylor> in other cases is also a coincidence.
Basically when you break a file-local relocation, the result is
platform-specific and undefined. Win32 just randomly picks another
symbol to use instead. There's also no linker command to change or
create a new file-local symbols; only global ones (and file-local
symbols take higher priority over global ones when resolving
relocations).
> If Windows used the .jcr mechanism you would simply strip the class
> reference from the .jcr section.

Sadly, that too is a file-local relocation. Aargh.
I've come up with a solution (see next post), but if you could help me
figure out exactly what linker trick to use, it would be much more
elegant than what I ended up doing.
 - a


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /