Skip to contentSkip to conversation

linker

Linux-ia64 Abhijit Kadlag 3 participants 3 messages Nov 26, 2002

lore
Share & tools
lore
#0 lore raw

i am trying to instrument the elf-binaries
on itanium. the task is to write a tool
like 'pixie' available on sgi machines.
since i need to add counters for each basic block, which
have to be in memory, i need some way of referencing memory. all i could find is itanium has only register indirect mode of specifying memory address and then again loading an address is done by the linker. i tried looking at the dis-assmebled code to discover how the linker does the offset calculation, but i could not find any correlation between program order of declaring variables and their offsets , which are added to r1(gp).
does it use the sections like .got or .plt in
elf binary ? if yes, how ?
shall anyone please tell me , how to add instructions
to the binary of an executable,
which can specify the memory they want to
access?

Signature · 5 lines
----------------------
Abhijit Kadlag
I sem ME,CSE,
Dept. of CSA,
IISc,Banagalore.
#1 lore raw

This isn't a topic that can be easily explained in a few mail messages.

There is a book authored by John R Levine _Linkers and Loaders_. I haven't read it myself, but I hear it is very good.
http://www.amazon.com/exec/obidos/tg/detail/-/1558604960/ref=lib_rd_btb/102-4344578-4148946?v=glance&s=books

You can find useful info in the various IA-64 ABI documents. The psABI and the Software Conventions and Runtime Architecture documents in particular. These are available via download from the Intel web page for Itanium.
http://developer.intel.com/design/itanium/arch_spec.htm
See also the ELF standard (gABI), which is available from SCO/Caldera.
http://www.caldera.com/developers/gabi

You can also learn a bit by using objdump and readelf to pretty print the contents of an ELF file. You can also learn a lot by spending time looking at and/or tracing through the GNU ld sources, though this may take some time.

Jim

#2 lore raw
In reply to Abhijit Kadlag
Quoted 3 lines · Jim Wilson

There is a book authored by John R Levine _Linkers and Loaders_. I haven't read it myself, but I hear it is very good.
http://www.amazon.com/exec/obidos/tg/detail/-/1558604960/ref=lib_rd_btb/102-4344578-4148946?v=glance&s=books

this book is available online in it's pre-release format at
http://www.iecc.com/linkers/

another good resource is "how to write shared libraries" by Ulrich Drepper (http://people.redhat.com/drepper/dsohowto.pdf)

-i
[email protected]