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: binutils as cross-tools for aix4.3


Nick Clifton wrote:
Hi Thibaud,

> I would like to use the gnu as and ld as cross development tools for
> aix4.3.  I read the previous releases were "broken" on that
> platform.  What's the status for the latest release: biuntils 2.13.1.

I believe that the 2.13.1 binutils are currently working for this
environment.  If you do encounter problems, please report them to this
mailing list.

Cheers
        Nick

Hi All,

The attached source file (struct-ret-1.s) generates a SIGILL signal on target powerpc-ibm-aix4.3.2 while executing.

The source file is the result of the compilation of the corresponding c file (also attached) with the following command line:
powerpc-ibm-aix4.3.2-gcc -O0 -S struct-ret-1.c

The output of the command "objdump -C -w -l -D -r struct-ret-1.o" show:

0000000000000408 <fp>:
 408: 00 00 04 32  .long 0x432 408: R_POS f+0xfffffffffffffbce
 40c: 00 00 02 c0  .long 0x2c0 40c: R_POS _structret1.rw_c+0xfffffffffffffd40

0000000000000410 <_structret1.rw_c>:
 410: 72 65 74 75  andil. r5,r19,29813
 414: 72 6e 20 76  andil. r14,r19,8310
 418: 61 6c 00 00  oril r12,r11,0
 ...
 430: 00 52 00 00  .long 0x520000

0000000000000432 <f>:
 ...
 434: R_POS .text
 438: R_POS TOC+0xfffffffffffffd00
 43a: 03 00 00 00  .long 0x3000000
 ...

0000000000000440 <main>:
 440: 00 00 01 34  .long 0x134 440: R_POS .text
 444: 00 00 03 00  .long 0x300 444: R_POS TOC+0xfffffffffffffd00

The data fp is a pointer to the function f.
fp contains 0x432 but f seens to be defined at 0x434.

I don't know if it's a gcc or gas problem.

I use the following tools:
binutils snapshot version 021208 and gcc snapshot version 20021209.

Thank you for your response.

Thibaud.
 
 

	.file	"/var/tmp/tortech/GNU/gcc-20021209/gcc/testsuite/gcc.c-torture/execute/struct-ret-1.c"
	.toc
	.csect .text[PR]
	.globl c1
	.csect .data[RW],3
c1:
	.byte	97
	.globl c2
c2:
	.byte	127
	.globl c3
c3:
	.byte	-128
	.globl c4
c4:
	.byte	-1
	.globl c5
c5:
	.byte	-1
	.globl d1
	.align 3
d1:
	.long	1069128089
	.long	-1717986918
	.globl d2
	.align 3
d2:
	.long	1070176665
	.long	-1717986918
	.globl d3
	.align 3
d3:
	.long	1070805811
	.long	858993459
	.globl d4
	.align 3
d4:
	.long	1071225241
	.long	-1717986918
	.globl d5
	.align 3
d5:
	.long	1071644672
	.long	0
	.globl d6
	.align 3
d6:
	.long	1071854387
	.long	858993459
	.globl d7
	.align 3
d7:
	.long	1072064102
	.long	1717986918
	.globl d8
	.align 3
d8:
	.long	1072273817
	.long	-1717986918
	.globl d9
	.align 3
d9:
	.long	1072483532
	.long	-858993459
	.globl B1
	.align 3
B1:
	.long	1069128089
	.long	-1717986918
	.long	1
	.long	2
	.long	3
	.space 4
	.globl B2
	.align 3
B2:
	.long	1070176665
	.long	-1717986918
	.long	5
	.long	4
	.long	3
	.space 4
	.globl X1
X1:
	.byte "abcdefghijklmnopqrstuvwxyzABCDEF"
	.byte 0
	.byte	71
	.globl X2
X2:
	.byte "123"
	.byte 0
	.space 29
	.byte	57
	.globl X3
X3:
	.byte "return-return-return"
	.byte 0
	.space 12
	.byte	82
	.csect _structret1.rw_c[RW],3
xr.0:
	.byte "return val"
	.byte 0
	.space 22
	.byte	82
	.csect _structret1.rw_c[RO],3
	.align 2
LC..1:
	.byte "X f(B,char,double,B):({%g,{%d,%d,%d}},'%c',%g,{%g,{%d,%d,%d}})"
	.byte 0
	.toc
LC..0:
	.tc xr.0[TC],xr.0
LC..2:
	.tc out[TC],out
LC..3:
	.tc LC..1[TC],LC..1
	.csect .text[PR]
	.align 2
	.globl f
	.globl .f
	.csect f[DS]
f:
	.long .f, TOC[tc0], 0
	.csect .text[PR]
.f:
	.extern __mulh
	.extern __mull
	.extern __divss
	.extern __divus
	.extern __quoss
	.extern __quous
	mflr 0
	stw 29,-12(1)
	stw 31,-4(1)
	stw 0,8(1)
	stwu 1,-160(1)
	mr 31,1
	mr 29,3
	stw 4,188(31)
	stw 5,192(31)
	stw 6,196(31)
	stw 7,200(31)
	stw 8,204(31)
	stw 9,208(31)
	mr 0,10
	stfd 1,88(31)
	stb 0,212(31)
	lwz 0,LC..0(2)
	addi 9,31,96
	li 11,34
	mr 3,9
	mr 4,0
	mr 5,11
	bl .memcpy
	nop
	lbz 0,212(31)
	stb 0,129(31)
	lbz 0,212(31)
	rlwinm 11,0,0,0xff
	lfd 0,88(31)
	stfd 0,56(1)
	lfd 0,224(31)
	stfd 0,64(1)
	lwz 0,232(31)
	stw 0,72(1)
	lwz 0,236(31)
	stw 0,76(1)
	lwz 0,240(31)
	stw 0,80(1)
	lwz 3,LC..2(2)
	lwz 4,LC..3(2)
	lwz 9,188(31)
	lwz 10,192(31)
	lfd 0,188(31)
	mr 5,9
	mr 6,10
	fmr 1,0
	lwz 7,196(31)
	lwz 8,200(31)
	lwz 9,204(31)
	mr 10,11
	lfd 0,56(1)
	fmr 2,0
	lfd 0,64(1)
	fmr 3,0
	bl .sprintf
	nop
	mr 0,29
	addi 9,31,96
	li 11,34
	mr 3,0
	mr 4,9
	mr 5,11
	bl .memcpy
	nop
	mr 3,29
	lwz 1,0(1)
	lwz 0,8(1)
	mtlr 0
	lwz 29,-12(1)
	lwz 31,-4(1)
	blr
LT..f:
	.long 0
	.byte 0,0,32,97,128,3,1,3
	.long 805306368
	.long LT..f-.f
	.short 1
	.byte "f"
	.byte 31
	.align 2
	.globl fp
	.csect .data[RW],3
	.align 2
fp:
	.long	f
	.toc
LC..4:
	.tc B1[TC],B1
LC..5:
	.tc c2[TC],c2
LC..6:
	.tc d3[TC],d3
LC..7:
	.tc B2[TC],B2
	.set LC..8,LC..2
LC..9:
	.tc fp[TC],fp
	.csect .text[PR]
	.align 2
	.globl main
	.globl .main
	.csect main[DS]
main:
	.long .main, TOC[tc0], 0
	.csect .text[PR]
.main:
	mflr 0
	stw 28,-16(1)
	stw 29,-12(1)
	stw 31,-4(1)
	stw 0,8(1)
	stwu 1,-264(1)
	mr 31,1
	lwz 11,LC..4(2)
	lwz 9,LC..5(2)
	lbz 0,0(9)
	rlwinm 29,0,0,0xff
	lwz 28,LC..6(2)
	lwz 9,LC..7(2)
	lwz 0,0(9)
	lwz 10,4(9)
	lwz 8,8(9)
	lwz 7,12(9)
	stw 0,64(1)
	stw 10,68(1)
	stw 8,72(1)
	stw 7,76(1)
	lwz 0,16(9)
	lwz 9,20(9)
	stw 0,80(1)
	stw 9,84(1)
	addi 3,31,88
	lwz 4,0(11)
	lwz 5,4(11)
	lwz 6,8(11)
	lwz 7,12(11)
	lwz 8,16(11)
	lwz 9,20(11)
	mr 10,29
	lfd 1,0(28)
	bl .f
	addi 0,31,136
	mr 3,0
	lwz 4,LC..8(2)
	bl .strcpy
	nop
	li 0,0
	stb 0,121(31)
	li 0,0
	stb 0,88(31)
	lwz 6,LC..9(2)
	lwz 10,LC..4(2)
	lwz 9,LC..5(2)
	lbz 0,0(9)
	rlwinm 29,0,0,0xff
	lwz 28,LC..6(2)
	lwz 9,LC..7(2)
	lwz 0,0(9)
	lwz 11,4(9)
	lwz 8,8(9)
	lwz 7,12(9)
	stw 0,64(1)
	stw 11,68(1)
	stw 8,72(1)
	stw 7,76(1)
	lwz 0,16(9)
	lwz 9,20(9)
	stw 0,80(1)
	stw 9,84(1)
	lwz 11,0(6)
	addi 3,31,88
	lwz 4,0(10)
	lwz 5,4(10)
	lwz 6,8(10)
	lwz 7,12(10)
	lwz 8,16(10)
	lwz 9,20(10)
	mr 10,29
	lfd 1,0(28)
	lwz 0,0(11)
	mtctr 0
	stw 2,20(1)
	lwz 2,4(11)
	lwz 11,8(11)
	bctrl
	lwz 2,20(1)
	addi 0,31,136
	mr 3,0
	lwz 4,LC..8(2)
	bl .strcmp
	nop
	mr 0,3
	cmpwi 0,0,0
	beq 0,L..3
	bl .abort
	nop
L..3:
	li 3,0
	bl .exit
	nop
LT..main:
	.long 0
	.byte 0,0,32,97,128,4,0,1
	.long LT..main-.main
	.short 4
	.byte "main"
	.byte 31
	.align 2
	.comm out,100,3
_section_.text:
	.csect .data[RW],3
	.long _section_.text
#include <stdio.h>
#include <string.h>

char out[100];

typedef struct { double d; int i[3]; } B;
typedef struct { char c[33],c1; } X;

char c1 = 'a';
char c2 = 127;
char c3 = (char)128;
char c4 = (char)255;
char c5 = -1;

double d1 = 0.1;
double d2 = 0.2;
double d3 = 0.3;
double d4 = 0.4;
double d5 = 0.5;
double d6 = 0.6;
double d7 = 0.7;
double d8 = 0.8;
double d9 = 0.9;

B B1 = {0.1,{1,2,3}};
B B2 = {0.2,{5,4,3}};
X X1 = {"abcdefghijklmnopqrstuvwxyzABCDEF", 'G'};
X X2 = {"123",'9'};
X X3 = {"return-return-return",'R'};

X f (B a, char b, double c, B d)
{
  static X xr = {"return val", 'R'};
  X r;
  r = xr;
  r.c1 = b;
  sprintf (out, "X f(B,char,double,B):({%g,{%d,%d,%d}},'%c',%g,{%g,{%d,%d,%d}})",
	   a.d, a.i[0], a.i[1], a.i[2], b, c, d.d, d.i[0], d.i[1], d.i[2]);
  return r;
}

X (*fp) (B, char, double, B) = &f;

main ()
{
  X Xr;
  char tmp[100];

  Xr = f (B1, c2, d3, B2);
  strcpy (tmp, out);
  Xr.c[0] = Xr.c1 = '\0';
  Xr = (*fp) (B1, c2, d3, B2);
  if (strcmp (tmp, out))
    abort ();

  exit (0);
}

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