This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
linking ld absolute address
- From: "Vineet Sharma, Noida" <vineets at noida dot hcltech dot com>
- To: binutils at sources dot redhat dot com
- Date: Thu, 27 Nov 2003 13:59:07 +0530
- Subject: linking ld absolute address
Hi,
There is a strange problem which i am facing when i resolve absolute
address for local label(label within a file) i get the right address, but
when i need an absolute address of the label outside the file i get a wrong
'0' address which is wrong.
How do i calculate the absolute address of a symbol?
I use the function:
static long
get_symbol_value (symbol)
asymbol *symbol;
{
long relocation = 0;
if (bfd_is_com_section (symbol->section))
relocation = 0;
else
relocation = symbol->value +
symbol->section->output_section->vma +
symbol->section->output_offset;
return relocation;
}
in function coff_XXX_reloc(abfd, reloc_entry, symbol_in, data,
input_section, output_bfd,
error_message)
what is the correct way to get an absolute address of a symbol?
If you want more detail first file is
---------------------------------------
FILE1
.text
xyz: jump abc
Ret
----------------------------------------
FILE2
.text
abc: jump xyz
Ret
----------------------------------------
Thanks in advance
Vineet