-
Notifications
You must be signed in to change notification settings - Fork 124
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
Build artificial samples with scons instead of make #16
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
19f63a8
Building artificial samples with scons-3, removed makefile
tbarabosch e3d0e08
Adjusted CHANGES.md
tbarabosch c00e266
Added whitespaces to CHANGES.md
tbarabosch 91c66cd
Removed unnecessary comments
dda9ca3
Scons3 seems to be broken on Ubuntu 16.04/18.04, switching back to sc…
dea551e
Adjusted Travis CI
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -218,3 +218,5 @@ src/cwe_checker.plugin | |
test/artificial_samples/dockcross* | ||
|
||
.#* | ||
|
||
.sconsign.dblite |
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
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,72 @@ | ||
import os | ||
import shutil | ||
|
||
supported_architectures = ['x64', 'x86', 'arm', 'mips', 'ppc'] | ||
|
||
c_compilers = {'x64': 'gcc', | ||
'x86': './dockcross-linux-x86 gcc', | ||
'arm': 'arm-linux-gnueabi-gcc', | ||
'mips': 'mips-linux-gnu-gcc', | ||
'ppc': 'powerpc-linux-gnu-gcc'} | ||
|
||
cpp_compilers = {'x64': 'g++', | ||
'x86': './dockcross-linux-x86 g++', | ||
'arm': 'arm-linux-gnueabi-g++-5', | ||
'mips': 'mips-linux-gnu-g++-5', | ||
'ppc': 'powerpc-linux-gnu-g++-5'} | ||
|
||
c_flags = {'x64': '-g -fno-stack-protector -std=c11', | ||
'x86': '-g -m32 -fno-stack-protector -std=c11', | ||
'arm': '-g -fno-stack-protector -std=c11', | ||
'mips': '-g -fno-stack-protector -std=c11', | ||
'ppc': '-g -fno-stack-protector -std=c11'} | ||
|
||
cpp_flags = {'x64': '-g -fno-stack-protector', | ||
'x86': '-g -m32 -fno-stack-protector', | ||
'arm': '-g -fno-stack-protector', | ||
'mips': '-g -fno-stack-protector', | ||
'ppc': '-g -fno-stack-protector'} | ||
|
||
def optimize(filename): | ||
optimize_me = ['cwe_476.c'] | ||
if filename in optimize_me: | ||
return ' -O3' | ||
else: | ||
return ' -O0' | ||
|
||
def compile_only_on_x64(filename, arch): | ||
only_x64 = ['cwe_782.c'] | ||
return filename in only_x64 and arch != 'x64' | ||
|
||
def build_c(arch): | ||
if shutil.which(c_compilers[arch]) is not None: | ||
c_programs = Glob('*.c') | ||
for p in c_programs: | ||
if compile_only_on_x64(str(p), arch): | ||
print('Skipping architecture %s for %s' % (arch, str(p))) | ||
continue | ||
env = Environment(CC = c_compilers[arch], | ||
CCFLAGS = c_flags[arch] + optimize(str(p))) | ||
env.Program('build/%s_%s.out' % (str(p).split('.')[0], arch), 'build/%s' % str(p)) | ||
# TODO: call execstack -s | ||
else: | ||
print('Compiler %s for architecture %s is not installed!' % (c_compilers[arch], arch)) | ||
|
||
|
||
def build_cpp(arch): | ||
if shutil.which(cpp_compilers[arch]) is not None: | ||
cpp_programs = Glob('*.cpp') | ||
for p in cpp_programs: | ||
env = Environment(CC = cpp_compilers[arch], | ||
CCFLAGS = cpp_flags[arch] + optimize(str(p))) | ||
env.Program('build/%s_%s.out' % (str(p).split('.')[0], arch), 'build/%s' % str(p)) | ||
# TODO: call execstack -s | ||
else: | ||
print('Compiler %s for architecture %s is not installed!' % (cpp_compilers[arch], arch)) | ||
|
||
|
||
VariantDir('build', '.', duplicate=0) | ||
for arch in supported_architectures: | ||
print('Building for architecture %s' % arch) | ||
build_c(arch) | ||
build_cpp(arch) |
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a test right now that depends on the call of execstack?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe none, I do not know why it was there in the first place.