Home
last modified time | relevance | path

Searched hist:dc4546097500fa3d1a31eabf027ce41370032d33 (Results 1 – 2 of 2) sorted by relevance

/optee_os/lib/libutils/isoc/include/
H A Dstdio.hdc4546097500fa3d1a31eabf027ce41370032d33 Thu Aug 17 15:55:15 UTC 2017 Jerome Forissier <jerome.forissier@linaro.org> libutee: provide an implementation of putchar()

Calling printf() from a TA to print a single character results in a
linker error:

39 TEE_Result TA_CreateEntryPoint(void)
40 {
41 printf(".");
42 /* ... */
43 }

hello_world_ta.o: In function `TA_CreateEntryPoint':
hello_world_ta.c:41: undefined reference to `putchar'

In this case, the compiler has optimized the printf() call into a call
to putchar(), assuming that we have a C library and that it complies to
the relevant standards (so that printf() and putchar() may be used
interchangeably).

One way to fix the issue is to prevent such optimizations by using
-fno-builtin or -ffreestanding, at the cost of slightly larger code
size and possibly reduced performance.

Another option is to simply provide the missing putchar() function. It
is the purpose of this commit.

Reported-by: Zeng Tao <prime.zeng@hisilicon.com>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
/optee_os/lib/libutee/
H A Dtrace_ext.cdc4546097500fa3d1a31eabf027ce41370032d33 Thu Aug 17 15:55:15 UTC 2017 Jerome Forissier <jerome.forissier@linaro.org> libutee: provide an implementation of putchar()

Calling printf() from a TA to print a single character results in a
linker error:

39 TEE_Result TA_CreateEntryPoint(void)
40 {
41 printf(".");
42 /* ... */
43 }

hello_world_ta.o: In function `TA_CreateEntryPoint':
hello_world_ta.c:41: undefined reference to `putchar'

In this case, the compiler has optimized the printf() call into a call
to putchar(), assuming that we have a C library and that it complies to
the relevant standards (so that printf() and putchar() may be used
interchangeably).

One way to fix the issue is to prevent such optimizations by using
-fno-builtin or -ffreestanding, at the cost of slightly larger code
size and possibly reduced performance.

Another option is to simply provide the missing putchar() function. It
is the purpose of this commit.

Reported-by: Zeng Tao <prime.zeng@hisilicon.com>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>