linking ld absolute address

Vineet Sharma, Noida vineets@noida.hcltech.com
Thu Nov 27 08:26:00 GMT 2003


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



More information about the Binutils mailing list