[Top][All Lists]

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

ld reloc error

From: wmrieker
Subject: ld reloc error
Date: Tue, 20 Apr 2004 10:46:04 -0400 (EDT)
User-agent: SquirrelMail/1.4.3 [CVS]

I define a global symbol, onetwothree=0x123 in defit.s.  I reference it in
another file, refit.s.

If I link everything as one big executable, it comes out as 0x123 in the
both the definition and reference files, which is what I want.

If I put both the definition and reference in a shareable (.so) file, the
reference gets relocated by the base of the shareable, which isn't right. 
The definition remains as 0x123, it does not get relocated.

I have attached a tar/gzip.  Script makeitall compiles everything from
scratch, links and runs it.  It uses as and ld from binutils-2.14.

  callit.s    - the main program, calls printit in the shareable

  printit.s   - calls defit_123 and refit_123 and prints out the results
  refit_123.s - does movl $onetwothree,%eax
  defit_123.s - defines onetwothree=0x123, and does movl $onetwothree,%eax

callit (executable) = callit.o
printit.so = printit.o + refit_123.o + defit_123.o

The 'onetwothree' of 'movl $onetwothree,%eax' in refit_123.s is apparently
getting relocated by the base load address of printit.so.  I don't think
it should be.

Mike Rieker

Attachment: ldbug.tgz
Description: application/gzip-compressed

reply via email to

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