To : bug-gcc@gnu.org
From: saito@densan.co.jp (Hideo Saito)
Title: Dynamic Relocation Error (bug of g++-3.0)
Hello. I am H.Saito, from Japan. I use NetBSD, mips3 and ELF.
I created shared library libstdc++.so from libstdc++.a.
I complied with g++(gcc-3.0) this program.
% g++ -o sss sss.c <return>
But I cannot execute sss for dynamic relocation error.
#include <stdio.h>
int (*p)(const char *, ...) = {printf};
main()
{
p("hello\n");
}
I compiled sss.c to assembler source sss.s.
% g++ -S sss.c <return>
Why is not aligned marked address (A) ?, see below.
My OS's dynamic loader faild to relocate this address marded (A)
from .rel.dyn section, because this section has odd address to marked (A).
$LFE1:
.section .eh_frame,"aw",@progbits
__FRAME_BEGIN__:
.4byte $LECIE1-$LSCIE1
$LSCIE1:
.4byte 0x0
.byte 0x1
.ascii "zP\000"
.byte 0x1
.byte 0x78
.byte 0x40
.byte 0x5
.byte 0x0
.4byte __gxx_personality_v0 <------(A)
.byte 0xc
.byte 0x1d
.byte 0x0
.align 2
Thank you. Good bye.
---log of compile------------------------------------------------------------
% g++ -S sss.c -v
Reading specs from /usr/gcc3.0/lib/gcc-lib/mips64-elf/3.0/specs
Configured with: ../../gcc-3.0/configure --prefix=/usr/gcc3.0 --srcdir=../../gcc-3.0 --host=mips64-elf --target=mips64-elf --with-elf --with-stabs --with-gnu-as --with-gnu-ld
Thread model: single
gcc version 3.0
/usr/gcc3.0/lib/gcc-lib/mips64-elf/3.0/cc1plus -v -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=0 -D__ANSI_COMPAT -DSYSTYPE_BSD -D_SYSTYPE_BSD -D__NetBSD__ -D__ELF__ -D_ABIN32 -D__NO_LEADING_UNDERSCORES__ -D__GP_SUPPORT__ -D__IEEE_BIG_ENDIAN -Ddevos -Dmips -Dunix -DMIPSEB -D_devos -D_mips -D_unix -D_MIPSEB -D__ANSI_COMPAT -D__SYSTYPE_BSD__ -D_SYSTYPE_BSD -D__NetBSD__ -D__ELF__ -D_ABIN32 -D__NO_LEADING_UNDERSCORES__ -D__GP_SUPPORT__ -D__IEEE_BIG_ENDIAN -D__devos__ -D__mips__ -D__unix__ -D__MIPSEB__ -D__devos__ -D__mips__ -D__unix__ -D_MIPSEB -D__SYSTYPE_BSD -D__devos -D__mips -D__unix -D__MIPSEB -D__devos -D__mips -D__unix -Amachine(mips) -Asystem(unix) -Asystem(NetBSD) -Asystem(devos) -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D__LANGUAGE_C -D_LANGUAGE_C -DLANGUAGE_C -D__SIZE_TYPE__=unsigned int -D__PTRDIFF_TYPE__=int -U__mips -D__mips=3 -D__mips64 sss.c -D__GNUG__=3 -D__GXX_DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -mabicalls -G0 -quiet -dumpbase sss.c -version -o !
!
!
sss.s
GNU CPP version 3.0 (cpplib) [AL 1.1, MM 40] BSD Mips
GNU C++ version 3.0 (mips64-elf)
compiled by GNU C version 2.95.2 19991024 (release).
ignoring nonexistent directory "/usr/gcc3.0/mips64-elf/include"
ignoring duplicate directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
/user2/FreeSoft/locale/libxpg4-3.3/locale
/usr/kde/include
/usr/gnome/include
/usr/local/include/glib-1.2
/usr/local/include/gtk-1.2
/usr/local/BerkeleyDB.3.1/include
/usr/local/include
/usr/tetex/include
/usr/X11/include
/usr/gcc/include
/usr/include
/usr/gcc3.0/include/g++-v3
/usr/gcc3.0/include/g++-v3/mips64-elf
/usr/gcc3.0/include/g++-v3/backward
/usr/gcc3.0/include
/usr/gcc3.0/lib/gcc-lib/mips64-elf/3.0/include
End of search list.
%
---sss.s--------------------------------------------------------------------
.file 1 "sss.c"
.abicalls
.globl p
.data
.align 2
.type p,@object
.size p,4
p:
.word printf
.rdata
.align 3
$LC0:
.ascii "hello\n\000"
.text
.align 2
.globl main
$LFB1:
.ent main
main:
.frame $fp,64,$31 # vars= 0, regs= 3/0, args= 32, extra= 8
.mask 0xd0000000,-8
.fmask 0x00000000,0
.set noreorder
.cpload $25
.set reorder
subu $sp,$sp,64
.cprestore 32
$LCFI0:
sd $31,56($sp)
$LCFI1:
sd $fp,48($sp)
$LCFI2:
sd $28,40($sp)
$LCFI3:
move $fp,$sp
$LCFI4:
la $4,$LC0
lw $2,p
move $25,$2
jal $31,$25
move $2,$0
move $sp,$fp
ld $31,56($sp)
ld $fp,48($sp)
addu $sp,$sp,64
j $31
.end main
$LFE1:
.section .eh_frame,"aw",@progbits
__FRAME_BEGIN__:
.4byte $LECIE1-$LSCIE1
$LSCIE1:
.4byte 0x0
.byte 0x1
.ascii "zP\000"
.byte 0x1
.byte 0x78
.byte 0x40
.byte 0x5
.byte 0x0
.4byte __gxx_personality_v0
.byte 0xc
.byte 0x1d
.byte 0x0
.align 2
$LECIE1:
$LSFDE1:
.4byte $LEFDE1-$LASFDE1
$LASFDE1:
.4byte $LASFDE1-__FRAME_BEGIN__
.4byte $LFB1
.4byte $LFE1-$LFB1
.byte 0x0
.byte 0x4
.4byte $LCFI0-$LFB1
.byte 0xe
.byte 0x40
.byte 0x4
.4byte $LCFI3-$LCFI0
.byte 0x9c
.byte 0x3
.byte 0x9e
.byte 0x2
.byte 0x5
.byte 0x40
.byte 0x1
.byte 0x4
.4byte $LCFI4-$LCFI3
.byte 0xc
.byte 0x1e
.byte 0x40
.align 2
$LEFDE1:
.align 0