public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* m68k-elf, flat format, reloc tables, binutils 2.16, gcc 4.1.1
@ 2007-08-03 19:53 Jate Sujjavanich
  2007-08-04  5:02 ` Mike Frysinger
  0 siblings, 1 reply; 4+ messages in thread
From: Jate Sujjavanich @ 2007-08-03 19:53 UTC (permalink / raw)
  To: binutils

I am looking for more information on how the linker generates reloc
tables. I am using binutils 2.16 and am trying to get shared libraries
working for the Coldfire architecture under uClinux. The first
dependency (shared library uClibc) fails to load because of invalid
values in the relocation table.

The first 123 values in the table resolve correctly into a table of
strings. For these, the output from readelf -r matches the values in the
binary.

Data + GOT size is 0x30dc0.

 Offset     Info    Type            Sym.Value  Sym. Name + Addend
00001e50  0007b301 R_68K_32          000010fc   _string_syserrmsgs + 0
Reloc table
34c90: 01032c10 (which is &.data + size(GOT) + Offset)
32c10: 01031ebc (which is &.data + size(GOT) + Sym.Value + Addend)

First question: are these forumulas correct for calculating these
pointer addresses?


The first reloc table entry not in the string section does not follow
this formula.

 Offset     Info    Type            Sym.Value  Sym. Name + Addend
0000213e  00000301 R_68K_32          00000000   .data + 2f9f
Reloc table
34e7c: 01032efe
32efe: 01033b7c (should be 01333d5f or 0x30dc0 + 0 + 0x2f9f?)

This is actually off by 0x1e3 which is the size of the GOT+3.


Table entry number 219 is totally wrong. It is 0x00000001, which tells
the flat loader that it's a reference to shared library 0 within shared
library 1. This is incorrect.

Most of the readelf relocation table entries are offsets of .data,
.text, and .bss.

Any descriptions and recommendations are greatly appreciated.

Jate Sujjavanich
Embedded Systems Engineer
Syn-tech Systems, Inc.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: m68k-elf, flat format, reloc tables, binutils 2.16, gcc 4.1.1
  2007-08-03 19:53 m68k-elf, flat format, reloc tables, binutils 2.16, gcc 4.1.1 Jate Sujjavanich
@ 2007-08-04  5:02 ` Mike Frysinger
  2007-08-07 13:24   ` Jate Sujjavanich
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2007-08-04  5:02 UTC (permalink / raw)
  To: binutils; +Cc: Jate Sujjavanich

[-- Attachment #1: Type: text/plain, Size: 504 bytes --]

On Friday 03 August 2007, Jate Sujjavanich wrote:
> I am looking for more information on how the linker generates reloc
> tables. I am using binutils 2.16 and am trying to get shared libraries
> working for the Coldfire architecture under uClinux. The first
> dependency (shared library uClibc) fails to load because of invalid
> values in the relocation table.

elf2flt is not a binutils thing, it's a uClinux thing.  you'd probably be 
better off asking on the uClinux-dev mailing list
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 827 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: m68k-elf, flat format, reloc tables, binutils 2.16, gcc 4.1.1
  2007-08-04  5:02 ` Mike Frysinger
@ 2007-08-07 13:24   ` Jate Sujjavanich
  2007-08-07 13:47     ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Jate Sujjavanich @ 2007-08-07 13:24 UTC (permalink / raw)
  To: binutils

I've checked out there list. What I am trying to figure out now is what
I sort of data I should be seeing based on the .data relocation tables.
This is so that I can try to figure out whether the error is in elf2flt
or the linker. So, I've picked out two entries from the output of a
readelf on the libc.elf intermediate binary.

[.rela.data]
 Offset     Info    Type            Sym.Value  Sym. Name + Addend
00001e50  0007b301 R_68K_32          000010fc   _string_syserrmsgs + 0
0000213e  00000301 R_68K_32          00000000   .data + 2f9f

My understanding is as follows. The relocation table for .rela.data is a
list of pointers in the data section which must be updated for relocated
code. The address of the pointer is .data start + offset. And the
pointer value should be .data start + sym value + offset.

Is this correct? The _string_syserrmsgs work out (easily verified
because they are string pointers). The data pointer does not appear to.
Does the info field give any explanation for this? Also, does anyone
have suggestions to make more sense of the symbol name ".data"? Many
table entries are merely offsets of .data, .bss, and .text, which does
not help out with verification.

- Jate S.

-----Original Message-----
From: Mike Frysinger [mailto:vapier@gentoo.org] 
Sent: Saturday, August 04, 2007 12:46 AM
To: binutils@sourceware.org
Cc: Jate Sujjavanich
Subject: Re: m68k-elf, flat format, reloc tables, binutils 2.16, gcc
4.1.1

On Friday 03 August 2007, Jate Sujjavanich wrote:
> I am looking for more information on how the linker generates reloc 
> tables. I am using binutils 2.16 and am trying to get shared libraries

> working for the Coldfire architecture under uClinux. The first 
> dependency (shared library uClibc) fails to load because of invalid 
> values in the relocation table.

elf2flt is not a binutils thing, it's a uClinux thing.  you'd probably
be better off asking on the uClinux-dev mailing list -mike

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: m68k-elf, flat format, reloc tables, binutils 2.16, gcc 4.1.1
  2007-08-07 13:24   ` Jate Sujjavanich
@ 2007-08-07 13:47     ` Andreas Schwab
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2007-08-07 13:47 UTC (permalink / raw)
  To: Jate Sujjavanich; +Cc: binutils

"Jate Sujjavanich" <jsujjavanich@syntech-fuelmaster.com> writes:

> [.rela.data]
>  Offset     Info    Type            Sym.Value  Sym. Name + Addend
> 00001e50  0007b301 R_68K_32          000010fc   _string_syserrmsgs + 0
> 0000213e  00000301 R_68K_32          00000000   .data + 2f9f
>
> My understanding is as follows. The relocation table for .rela.data is a
> list of pointers in the data section which must be updated for relocated
> code.

Type, sym value and sym name are derived fields.  The relocation entry
only contains offset, info and addend, where info encodes the type and
the symbol index.  Sym value is just the value of the symbol as recorded
in the symbol table.  The item to relocate is addressed by the offset
into the section, the value is computed according to the type (as
defined by the psABI).  For R_68K_32 the value is the (relocated) symbol
value plus the addend, to be stored in the 32 bit field at the offset.

> Also, does anyone have suggestions to make more sense of the symbol
> name ".data"?

It's the section symbol.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-08-07 13:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-03 19:53 m68k-elf, flat format, reloc tables, binutils 2.16, gcc 4.1.1 Jate Sujjavanich
2007-08-04  5:02 ` Mike Frysinger
2007-08-07 13:24   ` Jate Sujjavanich
2007-08-07 13:47     ` Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).