Hi,
Well, while US members of our list are not available yet, here are my
humble
comments.
IMHO this question has little to do with C programming skills :-)
Man, you're opening up a huge can of worms - linking obj files made
with entirely different compilers and moreover passing unsigned ints
from one to another (in C, functions return int by default).
Personally, I wouldn't even expect to get it 100% working at first
time.
fn_gcc.o: file format elf64-alpha Disassembly of section .text: 0000000000000000 <fn>:Alpha Assembly Language Programmer's Guide says that cmpeq compares
0: 0f c0 1f 20 lda v0,-16369(zero)
4: 10 c0 00 24 ldah v0,-16368(v0)
8: 20 f6 01 48 zapnot v0,0xf,v0
c: 01 80 fa 6b ret zero,(ra),0x1
...
objdump -d fn_ccc.o fn_ccc.o: file format elf64-alpha Disassembly of section .text: 0000000000000000 <fn>:
0: 10 c0 1f 24 ldah v0,-16368(zero)
4: 1f 04 ff 47 nop
8: 0f c0 00 20 lda v0,-16369(v0)
c: 01 80 fa 6b ret zero,(ra),0x1AD> To me it seems that returned results are different in these 2 cases.
GCC is inserting a ZAPNOT instruction to zero the top 4-bytes - is this correct ?Or is the main code compilation that is broken, I notice that ccc uses 'xor' to do the compare whereas gcc uses 'cmpeq' ?
> Cheers,
> Addy.
Rgds,
Andrei