Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do we need to add the fno-builtin compile option? #1722

Closed
prime-zeng opened this issue Jul 31, 2017 · 7 comments
Closed

Do we need to add the fno-builtin compile option? #1722

prime-zeng opened this issue Jul 31, 2017 · 7 comments

Comments

@prime-zeng
Copy link
Contributor

We can't use gcc builtin function in OP-TEE(TAs), so if we don't have the fno-builtin option, an linker error will be reported if we use the builtin functions by mistake, but i 'd rather to have this option and then report a compile error instead, any idea?

@jforissier
Copy link
Contributor

Hi @prime-zeng,

What do you mean? Do you have an example? (I suspect -fno-builtin is not the option you need but I want to make sure what problem you're trying to fix).

@jforissier
Copy link
Contributor

I realize my answer above may sound a bit mysterious ;-) so let me explain a bit more.
I don't think fno-builtin is desirable for TAs because, although TAs are supposed to use the GP API i.e., TEE_Malloc() rather than malloc() etc., we do provide libutils which is a partial implementation of the standard C library, so any assumption that the compiler could do about the standard functions should be valid, hence no need to disable those assumptions with -fno-builtin. Unless I'm missing something, which is why I'm asking for an example of a problem that is fixed with -fno-builtin.

@prime-zeng
Copy link
Contributor Author

prime-zeng commented Jul 31, 2017

For example, if you have the codeprintf("x") in the ta source, it will report undefined reference to putchar.

@jforissier
Copy link
Contributor

jforissier commented Jul 31, 2017

Ah, I see. So, builtins may generate calls to other standard functions that we may not have in our own libc (libutils). It makes sense, indeed.

Then I think what we need is -ffreestanding (which implies -fno-builtin). Can you test it please?

@prime-zeng
Copy link
Contributor Author

prime-zeng commented Jul 31, 2017

I just tried and it works, can you help to add it to the default cflags for TAs.

@jforissier
Copy link
Contributor

#1723

Thanks.

@prime-zeng
Copy link
Contributor Author

#1754 resolve this problem, close it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants