summaryrefslogtreecommitdiffstats
path: root/meta/classes/sanity.bbclass
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2013-07-15 15:10:26 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-07-18 21:23:41 +0100
commit4a6f939b4db2df5b93c9d1388e9d46fe8a7210a3 (patch)
tree8432ff28c0b5e4124611b30664995dd7d81cd4df /meta/classes/sanity.bbclass
parent344cf64642d8da4cbef1faf56b02556c7d0f539d (diff)
downloadpoky-4a6f939b4db2df5b93c9d1388e9d46fe8a7210a3.tar.gz
sanity.bbclass: Update gcc sanity check
The gcc sanity check should be checking for the atomic function directly instead of using the gcc macro. Older versions of gcc do not have the macro defined, but do support the atomic operations. (glib-2.0 checks for both the macro and the function, as long as one is available it will successfully compile.) Update the check to try both -mcpu=native and -mcpu=BUILD_ARCH. Tell the user which version worked properly. [YOCTO #4845] (From OE-Core rev: c126729b29822d3602c9c4fd9016cc79b6057fc5) Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/sanity.bbclass')
-rw-r--r--meta/classes/sanity.bbclass42
1 files changed, 29 insertions, 13 deletions
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index b190eb2347..a505a5dc34 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -280,31 +280,42 @@ def check_sanity_validmachine(sanity_data):
280 280
281# Checks if necessary to add option march to host gcc 281# Checks if necessary to add option march to host gcc
282def check_gcc_march(sanity_data): 282def check_gcc_march(sanity_data):
283 result = False 283 result = True
284 message = ""
284 285
285 # Check if -march not in BUILD_CFLAGS 286 # Check if -march not in BUILD_CFLAGS
286 if sanity_data.getVar("BUILD_CFLAGS",True).find("-march") < 0: 287 if sanity_data.getVar("BUILD_CFLAGS",True).find("-march") < 0:
288 result = False
287 289
288 # Construct a test file 290 # Construct a test file
289 f = open("gcc_test.c", "w") 291 f = open("gcc_test.c", "w")
290 f.write("int main (){ __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4; return 0;}\n") 292 f.write("int main (){ volatile int atomic = 2; __sync_bool_compare_and_swap (&atomic, 2, 3); return 0; }\n")
291 f.close() 293 f.close()
292 294
293 # Check if GCC could work without march 295 # Check if GCC could work without march
294 status,result = oe.utils.getstatusoutput("${BUILD_PREFIX}gcc gcc_test.c -o gcc_test") 296 if not result:
295 if status != 0: 297 status,res = oe.utils.getstatusoutput("${BUILD_PREFIX}gcc gcc_test.c -o gcc_test")
296 # Check if GCC could work with march 298 if status == 0:
297 status,result = oe.utils.getstatusoutput("${BUILD_PREFIX}gcc -march=native gcc_test.c -o gcc_test") 299 result = True;
298 if status != 0: 300
299 result = True 301 if not result:
300 else: 302 status,res = oe.utils.getstatusoutput("${BUILD_PREFIX}gcc -march=native gcc_test.c -o gcc_test")
301 result = False 303 if status == 0:
304 message = "BUILD_CFLAGS_append = \" -march=native\""
305 result = True;
306
307 if not result:
308 build_arch = sanity_data.getVar('BUILD_ARCH', True)
309 status,res = oe.utils.getstatusoutput("${BUILD_PREFIX}gcc -march=%s gcc_test.c -o gcc_test" % build_arch)
310 if status == 0:
311 message = "BUILD_CFLAGS_append = \" -march=%s\"" % build_arch
312 result = True;
302 313
303 os.remove("gcc_test.c") 314 os.remove("gcc_test.c")
304 if os.path.exists("gcc_test"): 315 if os.path.exists("gcc_test"):
305 os.remove("gcc_test") 316 os.remove("gcc_test")
306 317
307 return result 318 return (result, message)
308 319
309# Unpatched versions of make 3.82 are known to be broken. See GNU Savannah Bug 30612. 320# Unpatched versions of make 3.82 are known to be broken. See GNU Savannah Bug 30612.
310# Use a modified reproducer from http://savannah.gnu.org/bugs/?30612 to validate. 321# Use a modified reproducer from http://savannah.gnu.org/bugs/?30612 to validate.
@@ -506,9 +517,14 @@ def check_sanity_version_change(status, d):
506 if not check_app_exists("qemu-arm", d): 517 if not check_app_exists("qemu-arm", d):
507 status.addresult("qemu-native was in ASSUME_PROVIDED but the QEMU binaries (qemu-arm) can't be found in PATH") 518 status.addresult("qemu-native was in ASSUME_PROVIDED but the QEMU binaries (qemu-arm) can't be found in PATH")
508 519
509 if check_gcc_march(d): 520 (result, message) = check_gcc_march(d)
521 if result and message:
510 status.addresult("Your gcc version is older than 4.5, please add the following param to local.conf\n \ 522 status.addresult("Your gcc version is older than 4.5, please add the following param to local.conf\n \
511 BUILD_CFLAGS_append = \" -march=native\"\n") 523 %s\n" % message)
524 if not result:
525 status.addresult("Your gcc version is older then 4.5 or is not working properly. Please verify you can build")
526 status.addresult(" and link something that uses atomic operations, such as: \n")
527 status.addresult(" __sync_bool_compare_and_swap (&atomic, 2, 3);\n")
512 528
513 # Check that TMPDIR isn't on a filesystem with limited filename length (eg. eCryptFS) 529 # Check that TMPDIR isn't on a filesystem with limited filename length (eg. eCryptFS)
514 tmpdir = d.getVar('TMPDIR', True) 530 tmpdir = d.getVar('TMPDIR', True)