As usual on embedded systems you have to provide your own getchar() and putchar() routines. SDCC does not know whether the system connects to a serial line with or without handshake, LCD, keyboard or other device. You'll find examples for serial routines f.e. in sdcc/device/lib.
If you're short on memory you might want to use printf_small() instead of printf(). For the mcs51 there is an assembly version printf_fast() which should fit the requirements of many embedded systems (by unsetting #defines it can be customized to not support long variables and field widths).