Hi Paolo,
Thanks for your review!
Paolo Bonzini wrote:
+ AC_COMPILE_IFELSE([__thread int a; int b; int main() { return a = b; }],
+ [if grep __emutls_get_address conftest.$ac_objext
>/dev/null ; then
grepping in a binary file is not portable. If this works it would be
better:
AC_COMPILE_IFELSE([[__thread int a; int b;
extern void __emutls_get_address();
int main() {
__emutls_get_address();
return a = b;
}]],
[gcc_cv_use_emutls=yes],
[gcc_cv_use_emutls=no])
This does not work. For x86_64 native gcc, the compiler output is
$ gcc -c test.c
test.c:2: warning: conflicting types for built-in function
‘__emutls_get_address’
For Blackfin gcc, the compiler output is
$ bfin-uclinux-gcc -c test.c
test.c:2: warning: conflicting types for built-in function
‘__emutls_get_address’
Both are same.
I thought about using "int __emutls_v.a;" to trigger duplicate
definitions, but C don't allow dot in symbol name. If there is something
like AC_COMPILE_IFELSE but output assembly file instead of object file,
it will be the best choice. But I don't know if it exists. There is an
existing practice in autoconf (c.m4), which greps object file to find
out endianness. So I think grep object file might be acceptable.
Otherwise, the configury parts look fine to me.
Regards,
Jie