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]

Re: R_SPARC_RELATIVE vs R_SPARC_UA32 & unaligned unwind tables - again



> What does the reloc look like in the dynamic object?  Is it against a
> symbol or a section?  Is the section/symbol being loaded, or is it
> being dropped?

Here's a trivial test case, sample commands (running from the
gcc/testsuite directory), and output.  The last four bytes
output by dj-b.exe should be ef 7a 03 15.

--- dj-b.c
main()
{
  unsigned char *n = bar();
  int i;
  printf("0x%08x = ", n);
  for (i=0; i<9; i++)
    printf(" %02x", n[i]);
  printf("\n");
  return 0;
}

--- dj-s.s
        .file   "<stdin>"
        .global z
        .section        ".data"
        .type   z,#object
        .size   z,4
z:
        .byte   0
x:
        .uaword 0x123
y:
        .uaword x

--- dj-s2.c
extern char z[];
void *bar()
{
  return z;
}

--- commands
gcc -c dj-s2.c
../as dj-s.s -o dj-s.o
../g++ -B../ -shared dj-s.o dj-s2.o -o libdj-s.so -nostdlib
gcc dj-b.c -L. -ldj-s -o dj-b.exe

$ objdump -R libdj-s.so
DYNAMIC RELOCATION RECORDS
OFFSET   TYPE              VALUE 
00000304 R_SPARC_HI22      z
00000308 R_SPARC_LO10      z
00010319 R_SPARC_UA32      .data+0x00000001

$ ./dj-b.exe
0xef7a0314 =  00 00 00 01 23 00 79 00 01

$ (gdb) info shared
>From        To          Syms Read   Shared Object Library
0xef790000  0xef7a03a0  Yes         ./libdj-s.so

$ objdump -sh libdj-s.so

Contents of section .data:
 10314 00000001 23000000 00                 ....#....       

  6 .data         00000009  00010314  00010314  00000314  2**0
                  CONTENTS, ALLOC, LOAD, DATA


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