Hi,

I'm compiling a small test program that consist of two source  files.
I've uploaded the files as a zip archive to

http://www.sparetimelabs.com/sdccbug.zip 

and attached them as well.

My problem is that I get this error message:

?ASlink-Warning-Undefined Global '_putf_PARM_2' referenced by module
'printf'

where '_putf_PARM_2' is a compiler generated variable.

I'm compiling them with a script (included in the archive as file
'makeit' ) as follows :

------------------------------------------------------------
echo Compile hello.c
sdcc -mhc08 -c hello.c

echo Compile printf.c
sdcc -mhc08 -c printf.c

echo Link hello.c
sdcc -mhc08 --code-loc 0xE000 --stack-loc 0x00FF --xstack-loc 0x300
--data-loc 
0x0100 --idata-loc 0x080 --xram-loc 0x200 -o hello.S19  hello.rel
printf.rel
------------------------------------------------------------

This produces a link warning for a compiler generated variable the
compiler
uses to pass a parameter. And disassembling the generated code I see
that indeed the variable is not referenced properly.

The output from the script above is:

------------------------------------------------------------
Compile hello.c
Compile printf.c
Link hello.c

?ASlink-Warning-Undefined Global '_putf_PARM_2' referenced by module
'printf'
------------------------------------------------------------


My SDCC version is:

------------------------------------------------------------
sdcc -v
SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08
2.7.4 
#4988 (Jan  9 2008) (Mac OS X i386)
------------------------------------------------------------


Looking at the usage of the putf function  in 'printf.c'
I see that it is not the most common garden variety function call:

------------------------------------------------------------
typedef void (*putcf) (void*,char);
...
void tfp_format(void* putp,putcf putf,char *fmt, va_list va)
...
putf(putp,ch);
------------------------------------------------------------

So it is a call to a function through a function pointer...
could this be a compiler bug or am I doing something wrong?

Needles to say Ive compiled/linked and run this code
previously without any problems with gcc.

br Kusti








s

Attachment: printf.h
Description: Binary data

Attachment: printf.c
Description: Binary data

Attachment: makeit
Description: Binary data

Attachment: hello.c
Description: Binary data

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to