lkml.org 
[lkml]   [2020]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] kbuild: make Clang build userprogs for target architecture
On Wed, Jul 1, 2020 at 4:13 AM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> On Tue, Jun 30, 2020 at 6:26 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > I can reproduce this in the following
> > simple test code:
> >
> >
> > ----------------->8----------------
> > #include <stdio.h>
> >
> > int main(void)
> > {
> > ssize_t x = 1;
> >
> > printf("%zd", x);
> >
> > return 0;
> > }
> > --------------->8-------------------
>
> That is the old implicit int rule. Try including sys/types.h or
> compiling with a standard like -std=c99 for instance.
>
> Cheers,
> Miguel

Hmm, adding '#include <sys/types.h>' did not make any difference.




If I add -std=c99, I get a different error.


$ clang -std=c99 --target=aarch64-linux-gnu test.c
test.c:5:10: error: unknown type name 'ssize_t'; did you mean 'size_t'?
ssize_t x = 1;
^~~~~~~
size_t
/home/masahiro/tools/clang-latest/lib/clang/11.0.0/include/stddef.h:46:23:
note: 'size_t' declared here
typedef __SIZE_TYPE__ size_t;
^
1 error generated.





In contrast, 'size_t' has no problem.


----------------->8----------------
#include <stdio.h>

int main(void)
{
size_t x = 1;

printf("%zu", x);

return 0;
}
--------------->8-------------------

$ clang --target=aarch64-linux-gnu test.c
[ No warning ]




--
Best Regards
Masahiro Yamada

\
 
 \ /
  Last update: 2020-07-05 17:31    [W:0.084 / U:0.944 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site