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]

GNU as problem for aix4.3


Hi all,

I try to use the GNU assembler as a cross assembler for aix4.3.

The attached source file generates an Illegal Instruction signal on
aix4.3.
It was obtained by compiling the following c file by gcc.

    typedef struct { char c1; } X;

    void f () { static X xr = {'A'}; }

    void (*fp)() = &f ;

    /* main () { (*fp)(); } */


The output of objdump show that there's a problem with the symbol f in
the data segment (0x2d is an odd address).

    Disassembly of section .text:

    0000000000000000 <.f>:
       0: 93 e1 ff fc  st r31,-4(r1)
       4: 94 21 ff d8  stu r1,-40(r1)
       8: 7c 3f 0b 78  mr r31,r1
       c: 80 21 00 00  l r1,0(r1)
      10: 83 e1 ff fc  l r31,-4(r1)
      14: 4e 80 00 20  br
      18: 00 00 00 00  .long 0x0
      1c: 00 00 20 60  .long 0x2060
      20: 80 01 00 01  l r0,1(r1)
      24: 00 00 00 18  .long 0x18
      28: 00 01 66 1f  .long 0x1661f
    Disassembly of section .data:

    000000000000002c <TOC>:
      2c: 41 00 00 00  bc 8,0,2c <TOC>

    000000000000002d <f>:
          ...
      35: 00 00 2c 00  .long 0x2c00
      39: 00 00 00 00  .long 0x0

    000000000000003c <fp>:
      3c: 00 00 00 2d  .long 0x2d
      40: 00 00 00 2c  .long 0x2c


The function f seems to be well defined but at the address 0x30 (not
0x2d).
I patch the object file, and change the value of fp as follow,

    000000000000003c <fp>:
      3c: 00 00 00 30  .long 0x30
      40: 00 00 00 2c  .long 0x2c

and then I could execute it without any problem.

So it seems that there's a shift between the symbol data and the symbol
address.

This problem appears on both snapshot(030205) and release(2.13.2.1) of
binutils.

I try to investigate as far as I could. But now, I'm stuck.

Sorry if I report an already known bug.

Please, let me know if there's a patch to solve this problem (or a
workaround).

Thank's for your help.


Thibaud Tortech

	.file	"test.c"
	.toc
	.csect .text[PR]
	.csect _test.rw_c[RW],3
xr.0:
	.byte	65
	.csect .text[PR]
	.align 2
	.globl f
	.globl .f
	.csect f[DS]
f:
	.long .f, TOC[tc0], 0
	.csect .text[PR]
.f:
	stw 31,-4(1)
	stwu 1,-40(1)
	mr 31,1
	lwz 1,0(1)
	lwz 31,-4(1)
	blr
LT..f:
	.long 0
	.byte 0,0,32,96,128,1,0,1
	.long LT..f-.f
	.short 1
	.byte "f"
	.byte 31
	.align 2
	.globl fp
	.csect .data[RW],3
	.align 2
fp:
	.long	f
	.csect .text[PR]
_section_.text:
	.csect .data[RW],3
	.long _section_.text

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