Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
selftests, x86: Rework x86 target architecture detection
We currently fail to build on a non-multilib x86_64 target. We print a helpful error, but it's nicer to allow the build to succeed. Fix it and improve cross-compilation support by detecting architecture support directly and building only the relevant tests. Signed-off-by: Andy Lutomirski <luto@kernel.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
- Loading branch information
Showing
4 changed files
with
67 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
# check_cc.sh - Helper to test userspace compilation support | ||
# Copyright (c) 2015 Andrew Lutomirski | ||
# GPL v2 | ||
|
||
CC="$1" | ||
TESTPROG="$2" | ||
shift 2 | ||
|
||
if "$CC" -o /dev/null "$TESTPROG" -O0 "$@" 2>/dev/null; then | ||
echo 1 | ||
else | ||
echo 0 | ||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,10 @@ | |
* GPL v2 | ||
*/ | ||
|
||
#ifndef __i386__ | ||
# error wrong architecture | ||
#endif | ||
|
||
#include <stdio.h> | ||
|
||
int main() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Trivial program to check that we have a valid 32-bit build environment. | ||
* Copyright (c) 2015 Andy Lutomirski | ||
* GPL v2 | ||
*/ | ||
|
||
#ifndef __x86_64__ | ||
# error wrong architecture | ||
#endif | ||
|
||
#include <stdio.h> | ||
|
||
int main() | ||
{ | ||
printf("\n"); | ||
|
||
return 0; | ||
} |