Makefile and printf problems
Neville Mair
Neville_Mair@ipc.com
Tue Sep 16 09:36:00 GMT 1997
Canadian cross built on linux
gcc 2.7.2 68k-coff
running in a DOS box under NT
1) When I change an include file the make doesn't
cause a recompile. In the Makefile I put .KEEP_STATE,
no .make.state ( non valid filename in dos ) file is
generated. Is this my problem?
Has this been taken into account?
Is there a work-around?
2) How do I force printf to push the same number of bytes
for each parameter or for each TYPE of parameter?
Depending on the value of the parameter, the number of bytes
pushed changes. I get crashes (pointing into space) if I pass
a string after pasing an int.
If an int variable uses a calculated value it seems to work
since the optimizes doesnt know the final value.
Casting other data types to int does not work.
gcc -O3 -save-temps main.c
This is from main.i
# 1 "main.c"
int printf (const char *fmt, ...) ;
int main(void)
{
int x =123456;
short y =1 ;
printf("\nHello world %x %d %x %c ",(int)x,(int)y,10204050,'X') ;
return 1 ;
}
This is from main.s
NOTICE the 'pea 1.w ;# 22 movsi-2 '
__gnu_compiled_c:
.text
.LC0:
.ascii "\12Hello world %x %d %x %c \0"
.even
.globl main
main:
link.w %a6,#0
jsr __main ;# 8 call+1
pea 88.w ;# 17 movsi-2
move.l #10204050,-(%sp) ;# 19 movsi+1/1
pea 1.w ;# 22 movsi-2
move.l #123456,-(%sp) ;# 24 movsi+1/1
pea .LC0 ;# 26 movsi+1/1
jsr printf ;# 30 call_value+1
moveq.l #1,%d0 ;# 34 movsi+1/2
unlk %a6
rts
More information about the crossgcc
mailing list