bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Linux Linker / PIC and --defsym


From: address@hidden
Subject: Linux Linker / PIC and --defsym
Date: Wed, 07 Dec 2011 07:47:59 +0100

Hello,

Here is a suggestion to make --defsym / linker script
defined symbols relevant in PIC binaries:

Having --defsym to define a relocated symbol in a PIC 
library/executable is pointless (it does not serve ANY
purpose other than polluting the binary).

Therefore, the only relevant use of --defsym in a PIC 
shared library or PIC executable should be to have a 
*non-relocated* "absolute address".

Incidentally, that's the official purpose of --defsym:

"Create a global symbol in the output file, containing 
the absolute address given by expression."

Today's solution is to patch the relocation table after
the binary image has been loaded by the Linux linker.

Then, --defsym becomes useful in PIC libraries/executables
(with this feature, a shared library can call a function
located in a stripped executable).

-- 
Pierre Gauthier      | "Either find a way, or make one."
address@hidden | (Hannibal, 247-183 BC)

--------------- http://trustleap.ch/ -------------------

Paradiesli 17 - CH-8842 Unteriberg, SZ - Switzerland
Tel +41 (0)55 414 20 93 - Fax +41 (0)55 414 20 67




reply via email to

[Prev in Thread] Current Thread [Next in Thread]