Problem with post linking asm and C code

Hi everyone,
I might be posted to the wrong ng but it seems there're some assembly 
topic here, so I hope someone could help me..
here's the problem I'm finishing the porting of a logic program 
compiler (a superset of prolog working with tabular technic instead of 
backtracking) from Linux x86 to PPC arch (linux and os x, mainly osx)
I've made most of the work last year (10.3.9) on panther and appart 
some remaining bugs, it was compiling ok and working fine. Recently, 
I've upgraded my os to tiger and I tried to finish the port and now 
bang, nothing is working anymore.

the assembly generator works correctly (I've put a sample of generated 
code at the end and a minimul example to reproduce the step) and the 
bootstrap process is fine.
The linking process seems to be fine as well.
then when  I run the compiler  (gcc-3.3) I get this strange error :

dyld: unknown external relocation type
Trace/BPT trap

So far I've only  been able to find a reference to this problem on a 
blitz basic related forum without any other explanation else than "wait 
for the port to tiger"

I know that people's time is precious so here's an extract of the final 
linking command of the dynamic library and a link to  a small tarball 
showing the error

make LDFLAGS="-Wl,-read_only_relocs,suppress,-lpthread,-lm,-ldl" 
CC="gcc -fPIC -dynamiclib -undefined dynamic_lookup -single_module"

(Out of my despair, I've tried with and without the the CC flags of course)

the final link from the makefile command output was

/bin/sh ../libtool --tag=CC --mode=link gcc  -Wall -O3  
-Wl,-read_only_relocs,suppress,-lpthread,-lm,-ldl -o libdyalog.la 
-rpath /usr/local/lib/DyALog -version-info 1:0:0 machine.lo 
parameters.lo buffer.lo parser.lo file.lo hash.lo stream_supp.lo 
stream_c.lo char_io_c.lo set.lo archi.lo fol.lo symbol_info.lo 
printer.lo trail.lo vca.lo termop.lo collect.lo collapse.lo objects.lo 
tree-indexing.lo agenda.lo forest.lo debugtools.lo evalpred.lo 
rt-evalpred.lo bi_os.lo generalizer.lo pseudotfs.lo init.lo rt.lo 
dyam.lo oset.lo lexer.lo  builtin.lo boot.lo   -lgc -lm -ldl
gcc -dynamiclib ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o 
..libs/libdyalog.1.0.0.dylib  .libs/machine.o .libs/parameters.o 
..libs/buffer.o .libs/parser.o .libs/file.o .libs/hash.o 
..libs/stream_supp.o .libs/stream_c.o .libs/char_io_c.o .libs/set.o 
..libs/archi.o .libs/fol.o .libs/symbol_info.o .libs/printer.o 
..libs/trail.o .libs/vca.o .libs/termop.o .libs/collect.o 
..libs/collapse.o .libs/objects.o .libs/tree-indexing.o .libs/agenda.o 
..libs/forest.o .libs/debugtools.o .libs/evalpred.o .libs/rt-evalpred.o 
..libs/bi_os.o .libs/generalizer.o .libs/pseudotfs.o .libs/init.o 
..libs/rt.o .libs/dyam.o .libs/oset.o .libs/lexer.o .libs/builtin.o 
..libs/boot.o  /Users/djame/arch/ppc/lib/libgc.dylib -lm -ldl  
-Wl,-read_only_relocs -Wl,suppress -Wl,-lpthread -Wl,-lm -Wl,-ldl 
-install_name  /usr/local/lib/DyALog/libdyalog.1.dylib 
-Wl,-compatibility_version -Wl,2 -Wl,-current_version -Wl,2.0
(cd .libs && rm -f libdyalog.1.dylib && ln -s libdyalog.1.0.0.dylib 
(cd .libs && rm -f libdyalog.dylib && ln -s libdyalog.1.0.0.dylib 
ar cru .libs/libdyalog.a  machine.o parameters.o buffer.o parser.o 
file.o hash.o stream_supp.o stream_c.o char_io_c.o set.o archi.o fol.o 
symbol_info.o printer.o trail.o vca.o termop.o collect.o collapse.o 
objects.o tree-indexing.o agenda.o forest.o debugtools.o evalpred.o 
rt-evalpred.o bi_os.o generalizer.o pseudotfs.o init.o rt.o dyam.o 
oset.o lexer.o builtin.o boot.o
ranlib .libs/libdyalog.a
creating libdyalog.la
(cd .libs && rm -f libdyalog.la && ln -s ../libdyalog.la libdyalog.la)

the tarball is very small (700ko) and is downloadable here
there's a small script :  compile_pere.sh which compiles a small 
assembly source code generated from a very small logic program 
(father/2) and link it to the needed library
(libgc, a garbage collector, and libdyalog, the main runtime lib)

Thanks for any hints,

Djam� Seddah

ps :  sample of assembly generated code
         /* **** Pl_Call_Start  ****/
        /* Call Arg Variable */
         /* **** Call_Arg_Variable Prolog ****/
                /* (1) Load_label_in Machine Register r3 <- seed (no = 4) */
        addis   r3,0,ha16(_seed+4)
        addi    r3,r3,lo16(_seed+4)
         /* **** Move_To_Reg  ****/
         /* **** Move_To_Reg  aux ****/
                /* (1) Load_label_in Machine Register r15 <- trail (no = 0) */
        addis   r15,0,ha16(_trail+0)
        addi    r15,r15,lo16(_trail+0)
        stw     r3,128(r15) /* r(3) -> var */
         /* **** Call_Arg_Int Prolog ****/
         /* **** Move_Int_To_Reg  ****/
        /* ***** Load_Int_Machine_Register  **** */
        li      r3,0
         /* **** Move_To_Reg  ****/
         /* **** Move_To_Reg  aux ****/
                /* (1) Load_label_in Machine Register r15 <- trail (no = 0) */
        addis   r15,0,ha16(_trail+0)
        addi    r15,r15,lo16(_trail+0)
        stw     r3,132(r15) /* r(3) -> var */
         /* **** Pl_Call_Stop  ****/
                /* (1) Load_label_in Machine Register r20 <- .Lcont2 
(no = 0) */
        addis   r20,0,ha16(.Lcont2+0)
        addi    r20,r20,lo16(.Lcont2+0)
        stw     r20,60(r15)  /* R20 dans le cp */
         /* **** Pl_Jump  ****/
        b       L_fun9$stub
        .indirect_symbol        _fun4
        .long dyld_stub_binding_helper
        .indirect_symbol        _fun9
        mflr    r0
        bcl     20,31,L0$_fun9
        mflr    r11
        addis   r11,r11,ha16(L_fun9$lazy_ptr-L0$_fun9)
        mtlr    r0
        lwz     r12,lo16(L_fun9$lazy_ptr-L0$_fun9)(r11)
        mtctr   r12
        addi    r11,r11,lo16(L_fun9$lazy_ptr-L0$_fun9)
        .indirect_symbol        _fun9
        .long dyld_stub_binding_helper

1/8/2008 12:58:35 AM
comp.sys.powerpc.tech 819 articles. 1 followers. Post Follow

0 Replies

Similar Articles

[PageSpeed] 40