This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]