Questions regarding m68k dynamic/shared code
Ian Lance Taylor
Fri Jan 10 18:42:00 GMT 2003
Andreas Schwab <email@example.com> writes:
> Ian Lance Taylor <firstname.lastname@example.org> writes:
> |> > 3) What *does* the code in the .plt seciton actually do?
> |> The Procedure Linkage Table is used to support shared libraries. When
> |> code calls a function which is defined in a shared library, that call
> |> goes through the PLT. The PLT encodes the information required to
> |> find the function in the shared library, and calls code in the dynamic
> |> linker (ld.so) to locate that function and call it. Normally the
> |> actual lookup only happens the first time; after that, the PLT is
> |> changed to jump directly to the appropriate code for all subsequent
> |> calls.
> On m68k the PLT is doing an indirect jump through the corresponding GOT
> entry, and only the GOT entry is adjusted by the dynamic linker. This
> avoids all the complications of self-modifying code.
Yes, the approach used on most processors avoids self-modifying code
one way or another. When I said that the PLT is changed, I didn't
mean that the actual code is changed; just that the table information
More information about the Binutils