This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: questions about improving i386 PIC code


>>>>> John Carr writes:

John> In the IBM calling convention the caller sets the GOT register (via a
John> linker provided "glue" function) and restores it after the call.  In most
John> other PIC code the called function sets its own GOT.  gcc knows when a
John> direct call is to a static function.  gcc does not know when a function is
John> only called from the local file.

	The AIX port uses the fragment of code quoted in my previous
message to make that decision at the point of the call in the caller, not
within the callee.

	Without the type of analysis or directives that John mentions
(IBM's XLC has similar ones to avoid unnecessary TOC restores), it is
impossible for the compiler to know that all references to a function are
local to a module.

	Who provides addressibility (the caller or the callee), what
constitutes the common case, and how one can optimize the call are the
fundamental differences between SVR4 GOT and AIX TOC.  This is one of the
reasons that all AIX code is position independent while one explicitly
enables PIC for SVR4, primarily for use in shared libraries.


David


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]