[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/3869] New: The mapping behavior for small data of the ld for Pow
From: |
tanaka at personal-media dot co dot jp |
Subject: |
[Bug ld/3869] New: The mapping behavior for small data of the ld for PowerPC, from COMMON section to bss section. |
Date: |
15 Jan 2007 13:03:07 -0000 |
Hello,
By using ld for PowerPC, a small size variable in the COMMON section is mapped
to the bss section.
But By using ld for MIPS, a small size variable in the COMMON section is mapped
to the sbss section.
I think the behavior of the ld for MIPS is correct, and PowerPC's is something
wrong.
Below is a sample code.
/******* a.h ***********/
extern int a1[1];
int b( void );
/******* a.c ***********/
#include "a.h"
int a1[1];
void __start()
{
b();
}
/******* b.c ***********/
#include "a.h"
int b( void )
{
if (a1[1] == 0) {
return 0;
}
return 1;
}
/******* mk.rc *********/
#!/bin/sh
export LANG=C
### powerpc ###
ppcgcc="/work/te/tool/build/gnu/gcc-4.1.1-linux/Linux-i686.ppclinux/./gcc/xgcc"
ppcgcc="$ppcgcc
-B/work/te/tool/build/gnu/gcc-4.1.1-linux/Linux-i686.ppclinux/./gcc/"
ppcgcc="$ppcgcc -B/work/te/tool/Linux-i686.ppclinux/powerpc-unknown-linux/bin/"
$ppcgcc -msdata=sysv -G 8 -c -o a.ppc.o a.c
$ppcgcc -msdata=sysv -G 8 -c -o b.ppc.o b.c
$ppcgcc -msdata=sysv -G 8 -r -Wl,-d -nostdlib -o c.ppc.out a.ppc.o b.ppc.o
ppcobjdump="/work/te/tool/Linux-i686.ppclinux/bin/powerpc-unknown-linux-objdump"
$ppcobjdump --all-headers a.ppc.o > a.ppc.o.odp
$ppcobjdump --disassemble a.ppc.o >> a.ppc.o.odp
$ppcobjdump --all-headers b.ppc.o > b.ppc.o.odp
$ppcobjdump --disassemble b.ppc.o >> b.ppc.o.odp
$ppcobjdump --all-headers c.ppc.out > c.ppc.out.odp
$ppcobjdump --disassemble c.ppc.out >> c.ppc.out.odp
### mips ###
mipsgcc="/work/te/tool/build/gnu/gcc-4.1.1-linux/Linux-i686.mipslinux/./gcc/xgcc"
mipsgcc="$mipsgcc
-B/work/te/tool/build/gnu/gcc-4.1.1-linux/Linux-i686.mipslinux/./gcc/"
mipsgcc="$mipsgcc
-B/work/te/tool/Linux-i686.mipslinux/mips64el-unknown-linux/bin/"
$mipsgcc -O1 -c -o a.mips.o a.c
$mipsgcc -O1 -c -o b.mips.o b.c
$mipsgcc -O1 -r -Wl,-d -nostdlib -o c.mips.out a.mips.o b.mips.o
mipsobjdump="/work/te/tool/Linux-i686.mipslinux/bin/mips64el-unknown-linux-objdump"
$mipsobjdump --all-headers a.mips.o > a.mips.o.odp
$mipsobjdump --disassemble a.mips.o >> a.mips.o.odp
$mipsobjdump --all-headers b.mips.o > b.mips.o.odp
$mipsobjdump --disassemble b.mips.o >> b.mips.o.odp
$mipsobjdump --all-headers c.mips.out > c.mips.out.odp
$mipsobjdump --disassemble c.mips.out >> c.mips.out.odp
$ppcgcc -v
$mipsgcc -v
/***********************************************************/
Below is the result of the execution of "mk.rc".
/***********************************************************/
address@hidden:/work/test/scomm/$ ./mk.rc
Reading specs from
/work/te/tool/build/gnu/gcc-4.1.1-linux/Linux-i686.ppclinux/./gcc/specs
Target: powerpc-unknown-linux
Configured with: ../gcc-4.1.1/configure
--prefix=/work/te/tool/Linux-i686.ppclinux --target=powerpc-unknown-linux
--enable-languages=c --enable-threads=no
Thread model: single
gcc version 4.1.1
Reading specs from
/work/te/tool/build/gnu/gcc-4.1.1-linux/Linux-i686.mipslinux/./gcc/specs
Target: mips64el-unknown-linux
Configured with: ../gcc-4.1.1/configure
--prefix=/work/te/tool/Linux-i686.mipslinux --target=mips64el-unknown-linux
--enable-languages=c --enable-threads=no
Thread model: single
gcc version 4.1.1
address@hidden:/work/test/scomm/$
/***********************************************************/
Below is the output files for PowerPC.
/******** a.ppc.o.odp **********/
SYMBOL TABLE:
.
00000004 O *COM* 00000004 a1
/******** b.ppc.o.odp **********/
SYMBOL TABLE:
.
00000000 *UND* 00000000 a1
RELOCATION RECORDS FOR [.text]:
OFFSET TYPE VALUE
0000000e R_PPC_SDAREL16 a1+0x00000004
Disassembly of section .text:
00000000 <b>:
0: 94 21 ff e0 stwu r1,-32(r1)
4: 93 e1 00 1c stw r31,28(r1)
8: 7c 3f 0b 78 mr r31,r1
c: 80 0d 00 04 lwz r0,4(r13)
10: 2f 80 00 00 cmpwi cr7,r0,0
14: 40 9e 00 10 bne- cr7,24 <b+0x24>
.
.
/******** c.ppc.out.odp **********/
SYMBOL TABLE:
.
00000000 l df *ABS* 00000000 b.c
00000030 g F .text 00000044 b
00000000 g O .bss 00000004 a1 <===== .sbss ????
00000000 g F .text 00000030 __start
RELOCATION RECORDS FOR [.text]:
OFFSET TYPE VALUE
00000014 R_PPC_REL24 b
0000003e R_PPC_SDAREL16 a1+0x00000004
Disassembly of section .text:
00000000 <__start>:
0: 94 21 ff f0 stwu r1,-16(r1)
.
00000030 <b>:
30: 94 21 ff e0 stwu r1,-32(r1)
34: 93 e1 00 1c stw r31,28(r1)
38: 7c 3f 0b 78 mr r31,r1
3c: 80 0d 00 04 lwz r0,4(r13)
40: 2f 80 00 00 cmpwi cr7,r0,0
44: 40 9e 00 10 bne- cr7,54 <b+0x24>
.
/***********************************************************/
Below is the output files for MIPS.
/******** a.mips.o.odp **********/
SYMBOL TABLE:
.
00000004 O *COM* 00000008 a1
/******** b.mips.o.odp **********/
SYMBOL TABLE:
.
00000000 g F .text 0000001c b
00000000 *UND* 00000000 a1
RELOCATION RECORDS FOR [.text]:
OFFSET TYPE VALUE
.
0000000c R_MIPS_GOT_DISP a1
.
Disassembly of section .text:
00000000 <b>:
0: 3c030000 lui v1,0x0
4: 00791821 addu v1,v1,t9
8: 24630000 addiu v1,v1,0
c: 8c620000 lw v0,0(v1)
10: 8c420004 lw v0,4(v0)
14: 03e00008 jr ra
.
/******** c.mips.out.odp **********/
SYMBOL TABLE:
.
00000040 g F .text 0000001c b
00000000 g O .sbss 00000004 a1 <============= .sbss
00000000 g F .text 00000034 __start
RELOCATION RECORDS FOR [.text]:
OFFSET TYPE VALUE
.
0000004c R_MIPS_GOT_DISP a1
Disassembly of section .text:
00000000 <__start>:
0: 27bdfff0 addiu sp,sp,-16
.
00000040 <b>:
40: 3c030000 lui v1,0x0
44: 00791821 addu v1,v1,t9
48: 24630000 addiu v1,v1,0
4c: 8c620000 lw v0,0(v1)
50: 8c420004 lw v0,4(v0)
54: 03e00008 jr ra
/***********************************************************/
Best regards.
tanaka
-----------------------------------------------------------------------------------
--
Summary: The mapping behavior for small data of the ld for
PowerPC, from COMMON section to bss section.
Product: binutils
Version: 2.17
Status: NEW
Severity: normal
Priority: P2
Component: ld
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: tanaka at personal-media dot co dot jp
CC: bug-binutils at gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: powerpc-unknown-linux
http://sourceware.org/bugzilla/show_bug.cgi?id=3869
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug ld/3869] New: The mapping behavior for small data of the ld for PowerPC, from COMMON section to bss section.,
tanaka at personal-media dot co dot jp <=