More cross compiler assertion fun

undefined reference to `___eprintf'

Got this fun one in dwarf.c (and probably many others) while building an ELF toolchain from Linux to run on Windows to target.. Linux.  Anyways I think this is a symptom of Canadian Cross compilers.

So a little digging and ___eprintf turns out to be from the assert.h as macros for assert depend on this being in libgcc.a .. And yeah, MinGW uses something else.  So just copy the assert.h from MinGW, and re-build and away it works.

D:\elfgcc\bin>cc1
int main(){printf("hi!\n");return 0;}
.file "stdin"
.version "01.01"
gcc2_compiled.:
main.section .rodata
.LC0:
.string "hi!\n"
.text
.align 4
.globl main
.type main,@function
main:
pushl %ebp
movl %esp,%ebp
pushl $.LC0
call printf
addl $4,%esp
xorl %eax,%eax
jmp .L1
.align 4
.L1:
leave
ret
.Lfe1:
.size main,.Lfe1-main
^Z
.ident "GCC: (GNU) 2.7.2.3"

time in parse: 1.155000
time in integration: 0.000000
time in jump: 0.000000
time in cse: 0.000000
time in loop: 0.000000
time in cse2: 0.000000
time in flow: 0.000000
time in combine: 0.000000
time in sched: 0.000000
time in local-alloc: 0.000000
time in global-alloc: 0.000000
time in sched2: 0.000000
time in dbranch: 0.000000
time in shorten-branch: 0.000000
time in stack-reg: 0.000000
time in final: 0.000000
time in varconst: 0.000000
time in symout: 0.000000
time in dump: 0.000000

Well, wasn’t that fun?

Leave a Reply

Your email address will not be published. Required fields are marked *