Re: [PATCHi v1] PowerPC: Create call stubs for compiled modules

Ulrich Weigand <[email protected]>
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
Abhay Kandpal <[email protected]> wrote:

>The compile command loads a module into inferior memory and relocates
>it itself, without a linker.  For R_PPC64_REL24 it patches the branch
>to point directly at the target.  On ELFv2 that is not a valid call to
>another module: the callee derives its TOC pointer from r12, which
only
>a PLT-style call stub sets up, and the caller's TOC pointer is never
>restored because the nop following the bl is left alone.

On other platforms, the way this is supposed to work is to use a
set of compiler command-line options that result in code that does
not require PLTs for external calls.  Typically, this means to use
-mcmodel=large.

However, it seems that on PowerPC, while that option exists, it
generates code that still needs PLTs.  There is another option
-mlongcall that should avoid this, however.

I'm wondering if we were to just add -mlongcall to the platform-
specific compiler options for PowerPC, we could fix this issue
without having to reimplement a full PLT solution in GDB ...

Bye,
Ulrich
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.