SConscript (11985:03e3d059c4b9) | SConscript (11988:665cd5f8b52b) |
---|---|
1# -*- mode:python -*- 2 3# Copyright (c) 2004-2005 The Regents of The University of Michigan 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions are 8# met: redistributions of source code must retain the above copyright --- 162 unchanged lines hidden (view full) --- 171 172 @classmethod 173 def set_group(cls, group): 174 if not group in Source.source_groups: 175 Source.source_groups[group] = [] 176 Source.current_group = group 177 178 '''Add a c/c++ source file to the build''' | 1# -*- mode:python -*- 2 3# Copyright (c) 2004-2005 The Regents of The University of Michigan 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions are 8# met: redistributions of source code must retain the above copyright --- 162 unchanged lines hidden (view full) --- 171 172 @classmethod 173 def set_group(cls, group): 174 if not group in Source.source_groups: 175 Source.source_groups[group] = [] 176 Source.current_group = group 177 178 '''Add a c/c++ source file to the build''' |
179 def __init__(self, source, Werror=True, swig=False, **guards): | 179 def __init__(self, source, Werror=True, **guards): |
180 '''specify the source file, and any guards''' 181 super(Source, self).__init__(source, **guards) 182 183 self.Werror = Werror | 180 '''specify the source file, and any guards''' 181 super(Source, self).__init__(source, **guards) 182 183 self.Werror = Werror |
184 self.swig = swig | |
185 186 Source.source_groups[Source.current_group].append(self) 187 188class PySource(SourceFile): 189 '''Add a python source file to the named package''' 190 invalid_sym_char = re.compile('[^A-z0-9_]') 191 modules = {} 192 tnodes = {} --- 45 unchanged lines hidden (view full) --- 238 '''Specify the source file and any guards (automatically in 239 the m5.objects package)''' 240 super(SimObject, self).__init__('m5.objects', source, **guards) 241 if self.fixed: 242 raise AttributeError, "Too late to call SimObject now." 243 244 bisect.insort_right(SimObject.modnames, self.modname) 245 | 184 185 Source.source_groups[Source.current_group].append(self) 186 187class PySource(SourceFile): 188 '''Add a python source file to the named package''' 189 invalid_sym_char = re.compile('[^A-z0-9_]') 190 modules = {} 191 tnodes = {} --- 45 unchanged lines hidden (view full) --- 237 '''Specify the source file and any guards (automatically in 238 the m5.objects package)''' 239 super(SimObject, self).__init__('m5.objects', source, **guards) 240 if self.fixed: 241 raise AttributeError, "Too late to call SimObject now." 242 243 bisect.insort_right(SimObject.modnames, self.modname) 244 |
246class SwigSource(SourceFile): 247 '''Add a swig file to build''' 248 249 def __init__(self, package, source, **guards): 250 '''Specify the python package, the source file, and any guards''' 251 super(SwigSource, self).__init__(source, skip_no_python=True, **guards) 252 253 modname,ext = self.extname 254 assert ext == 'i' 255 256 self.package = package 257 self.module = modname 258 cc_file = joinpath(self.dirname, modname + '_wrap.cc') 259 py_file = joinpath(self.dirname, modname + '.py') 260 261 self.cc_source = Source(cc_file, swig=True, parent=self, **guards) 262 self.py_source = PySource(package, py_file, parent=self, **guards) 263 | |
264class ProtoBuf(SourceFile): 265 '''Add a Protocol Buffer to build''' 266 267 def __init__(self, source, **guards): 268 '''Specify the source file, and any guards''' 269 super(ProtoBuf, self).__init__(source, **guards) 270 271 # Get the file name and the extension --- 26 unchanged lines hidden (view full) --- 298 self.target = target 299 self.main = kwargs.get('main', False) 300 UnitTest.all.append(self) 301 302# Children should have access 303Export('Source') 304Export('PySource') 305Export('SimObject') | 245class ProtoBuf(SourceFile): 246 '''Add a Protocol Buffer to build''' 247 248 def __init__(self, source, **guards): 249 '''Specify the source file, and any guards''' 250 super(ProtoBuf, self).__init__(source, **guards) 251 252 # Get the file name and the extension --- 26 unchanged lines hidden (view full) --- 279 self.target = target 280 self.main = kwargs.get('main', False) 281 UnitTest.all.append(self) 282 283# Children should have access 284Export('Source') 285Export('PySource') 286Export('SimObject') |
306Export('SwigSource') | |
307Export('ProtoBuf') 308Export('UnitTest') 309 310######################################################################## 311# 312# Debug Flags 313# 314debug_flags = {} --- 239 unchanged lines hidden (view full) --- 554# we need to unload all of the currently imported modules so that they 555# will be re-imported the next time the sconscript is run 556importer.unload() 557sys.meta_path.remove(importer) 558 559sim_objects = m5.SimObject.allClasses 560all_enums = m5.params.allEnums 561 | 287Export('ProtoBuf') 288Export('UnitTest') 289 290######################################################################## 291# 292# Debug Flags 293# 294debug_flags = {} --- 239 unchanged lines hidden (view full) --- 534# we need to unload all of the currently imported modules so that they 535# will be re-imported the next time the sconscript is run 536importer.unload() 537sys.meta_path.remove(importer) 538 539sim_objects = m5.SimObject.allClasses 540all_enums = m5.params.allEnums 541 |
562if m5.SimObject.noCxxHeader: 563 print >> sys.stderr, \ 564 "warning: At least one SimObject lacks a header specification. " \ 565 "This can cause unexpected results in the generated SWIG " \ 566 "wrappers." 567 568# Find param types that need to be explicitly wrapped with swig. 569# These will be recognized because the ParamDesc will have a 570# swig_decl() method. Most param types are based on types that don't 571# need this, either because they're based on native types (like Int) 572# or because they're SimObjects (which get swigged independently). 573# For now the only things handled here are VectorParam types. 574params_to_swig = {} | |
575for name,obj in sorted(sim_objects.iteritems()): 576 for param in obj._params.local.values(): 577 # load the ptype attribute now because it depends on the 578 # current version of SimObject.allClasses, but when scons 579 # actually uses the value, all versions of 580 # SimObject.allClasses will have been loaded 581 param.ptype 582 | 542for name,obj in sorted(sim_objects.iteritems()): 543 for param in obj._params.local.values(): 544 # load the ptype attribute now because it depends on the 545 # current version of SimObject.allClasses, but when scons 546 # actually uses the value, all versions of 547 # SimObject.allClasses will have been loaded 548 param.ptype 549 |
583 if not hasattr(param, 'swig_decl'): 584 continue 585 pname = param.ptype_str 586 if pname not in params_to_swig: 587 params_to_swig[pname] = param 588 | |
589######################################################################## 590# 591# calculate extra dependencies 592# 593module_depends = ["m5", "m5.SimObject", "m5.params"] 594depends = [ PySource.modules[dep].snode for dep in module_depends ] 595depends.sort(key = lambda x: x.name) 596 --- 66 unchanged lines hidden (view full) --- 663 name = str(source[0].get_contents()) 664 obj = sim_objects[name] 665 666 code = code_formatter() 667 obj.cxx_config_param_file(code, is_header) 668 code.write(target[0].abspath) 669 return body 670 | 550######################################################################## 551# 552# calculate extra dependencies 553# 554module_depends = ["m5", "m5.SimObject", "m5.params"] 555depends = [ PySource.modules[dep].snode for dep in module_depends ] 556depends.sort(key = lambda x: x.name) 557 --- 66 unchanged lines hidden (view full) --- 624 name = str(source[0].get_contents()) 625 obj = sim_objects[name] 626 627 code = code_formatter() 628 obj.cxx_config_param_file(code, is_header) 629 code.write(target[0].abspath) 630 return body 631 |
671def createParamSwigWrapper(target, source, env): 672 assert len(target) == 1 and len(source) == 1 673 674 name = str(source[0].get_contents()) 675 param = params_to_swig[name] 676 677 code = code_formatter() 678 param.swig_decl(code) 679 code.write(target[0].abspath) 680 | |
681def createEnumStrings(target, source, env): 682 assert len(target) == 1 and len(source) == 1 683 684 name = str(source[0].get_contents()) 685 obj = all_enums[name] 686 687 code = code_formatter() 688 obj.cxx_def(code) | 632def createEnumStrings(target, source, env): 633 assert len(target) == 1 and len(source) == 1 634 635 name = str(source[0].get_contents()) 636 obj = all_enums[name] 637 638 code = code_formatter() 639 obj.cxx_def(code) |
640 if env['USE_PYTHON']: 641 obj.pybind_def(code) |
|
689 code.write(target[0].abspath) 690 691def createEnumDecls(target, source, env): 692 assert len(target) == 1 and len(source) == 1 693 694 name = str(source[0].get_contents()) 695 obj = all_enums[name] 696 697 code = code_formatter() 698 obj.cxx_decl(code) 699 code.write(target[0].abspath) 700 | 642 code.write(target[0].abspath) 643 644def createEnumDecls(target, source, env): 645 assert len(target) == 1 and len(source) == 1 646 647 name = str(source[0].get_contents()) 648 obj = all_enums[name] 649 650 code = code_formatter() 651 obj.cxx_decl(code) 652 code.write(target[0].abspath) 653 |
701def createEnumSwigWrapper(target, source, env): 702 assert len(target) == 1 and len(source) == 1 703 704 name = str(source[0].get_contents()) 705 obj = all_enums[name] 706 707 code = code_formatter() 708 obj.swig_decl(code) 709 code.write(target[0].abspath) 710 711def createSimObjectSwigWrapper(target, source, env): | 654def createSimObjectPyBindWrapper(target, source, env): |
712 name = source[0].get_contents() 713 obj = sim_objects[name] 714 715 code = code_formatter() | 655 name = source[0].get_contents() 656 obj = sim_objects[name] 657 658 code = code_formatter() |
716 obj.swig_decl(code) | 659 obj.pybind_decl(code) |
717 code.write(target[0].abspath) 718 | 660 code.write(target[0].abspath) 661 |
719# dummy target for generated code 720# we start out with all the Source files so they get copied to build/*/ also. 721SWIG = env.Dummy('swig', [s.tnode for s in Source.get()]) 722 | |
723# Generate all of the SimObject param C++ struct header files 724params_hh_files = [] 725for name,simobj in sorted(sim_objects.iteritems()): 726 py_source = PySource.modules[simobj.__module__] 727 extra_deps = [ py_source.tnode ] 728 729 hh_file = File('params/%s.hh' % name) 730 params_hh_files.append(hh_file) 731 env.Command(hh_file, Value(name), 732 MakeAction(createSimObjectParamStruct, Transform("SO PARAM"))) 733 env.Depends(hh_file, depends + extra_deps) | 662# Generate all of the SimObject param C++ struct header files 663params_hh_files = [] 664for name,simobj in sorted(sim_objects.iteritems()): 665 py_source = PySource.modules[simobj.__module__] 666 extra_deps = [ py_source.tnode ] 667 668 hh_file = File('params/%s.hh' % name) 669 params_hh_files.append(hh_file) 670 env.Command(hh_file, Value(name), 671 MakeAction(createSimObjectParamStruct, Transform("SO PARAM"))) 672 env.Depends(hh_file, depends + extra_deps) |
734 env.Depends(SWIG, hh_file) | |
735 736# C++ parameter description files 737if GetOption('with_cxx_config'): 738 for name,simobj in sorted(sim_objects.iteritems()): 739 py_source = PySource.modules[simobj.__module__] 740 extra_deps = [ py_source.tnode ] 741 742 cxx_config_hh_file = File('cxx_config/%s.hh' % name) --- 40 unchanged lines hidden (view full) --- 783 MakeAction(createCxxConfigInitCC, Transform("CXXCINIT"))) 784 cxx_param_hh_files = ["cxx_config/%s.hh" % simobj 785 for name,simobj in sorted(sim_objects.iteritems()) 786 if not hasattr(simobj, 'abstract') or not simobj.abstract] 787 Depends(cxx_config_init_cc_file, cxx_param_hh_files + 788 [File('sim/cxx_config.hh')]) 789 Source(cxx_config_init_cc_file) 790 | 673 674# C++ parameter description files 675if GetOption('with_cxx_config'): 676 for name,simobj in sorted(sim_objects.iteritems()): 677 py_source = PySource.modules[simobj.__module__] 678 extra_deps = [ py_source.tnode ] 679 680 cxx_config_hh_file = File('cxx_config/%s.hh' % name) --- 40 unchanged lines hidden (view full) --- 721 MakeAction(createCxxConfigInitCC, Transform("CXXCINIT"))) 722 cxx_param_hh_files = ["cxx_config/%s.hh" % simobj 723 for name,simobj in sorted(sim_objects.iteritems()) 724 if not hasattr(simobj, 'abstract') or not simobj.abstract] 725 Depends(cxx_config_init_cc_file, cxx_param_hh_files + 726 [File('sim/cxx_config.hh')]) 727 Source(cxx_config_init_cc_file) 728 |
791# Generate any needed param SWIG wrapper files 792params_i_files = [] 793for name,param in sorted(params_to_swig.iteritems()): 794 i_file = File('python/_m5/%s.i' % (param.swig_module_name())) 795 params_i_files.append(i_file) 796 env.Command(i_file, Value(name), 797 MakeAction(createParamSwigWrapper, Transform("SW PARAM"))) 798 env.Depends(i_file, depends) 799 env.Depends(SWIG, i_file) 800 SwigSource('_m5', i_file) 801 | |
802# Generate all enum header files 803for name,enum in sorted(all_enums.iteritems()): 804 py_source = PySource.modules[enum.__module__] 805 extra_deps = [ py_source.tnode ] 806 807 cc_file = File('enums/%s.cc' % name) 808 env.Command(cc_file, Value(name), 809 MakeAction(createEnumStrings, Transform("ENUM STR"))) 810 env.Depends(cc_file, depends + extra_deps) | 729# Generate all enum header files 730for name,enum in sorted(all_enums.iteritems()): 731 py_source = PySource.modules[enum.__module__] 732 extra_deps = [ py_source.tnode ] 733 734 cc_file = File('enums/%s.cc' % name) 735 env.Command(cc_file, Value(name), 736 MakeAction(createEnumStrings, Transform("ENUM STR"))) 737 env.Depends(cc_file, depends + extra_deps) |
811 env.Depends(SWIG, cc_file) | |
812 Source(cc_file) 813 814 hh_file = File('enums/%s.hh' % name) 815 env.Command(hh_file, Value(name), 816 MakeAction(createEnumDecls, Transform("ENUMDECL"))) 817 env.Depends(hh_file, depends + extra_deps) | 738 Source(cc_file) 739 740 hh_file = File('enums/%s.hh' % name) 741 env.Command(hh_file, Value(name), 742 MakeAction(createEnumDecls, Transform("ENUMDECL"))) 743 env.Depends(hh_file, depends + extra_deps) |
818 env.Depends(SWIG, hh_file) | |
819 | 744 |
820 i_file = File('python/_m5/enum_%s.i' % name) 821 env.Command(i_file, Value(name), 822 MakeAction(createEnumSwigWrapper, Transform("ENUMSWIG"))) 823 env.Depends(i_file, depends + extra_deps) 824 env.Depends(SWIG, i_file) 825 SwigSource('_m5', i_file) | 745# Generate SimObject Python bindings wrapper files 746if env['USE_PYTHON']: 747 for name,simobj in sorted(sim_objects.iteritems()): 748 py_source = PySource.modules[simobj.__module__] 749 extra_deps = [ py_source.tnode ] 750 cc_file = File('python/_m5/param_%s.cc' % name) 751 env.Command(cc_file, Value(name), 752 MakeAction(createSimObjectPyBindWrapper, 753 Transform("SO PyBind"))) 754 env.Depends(cc_file, depends + extra_deps) 755 Source(cc_file) |
826 | 756 |
827# Generate SimObject SWIG wrapper files 828for name,simobj in sorted(sim_objects.iteritems()): 829 py_source = PySource.modules[simobj.__module__] 830 extra_deps = [ py_source.tnode ] 831 i_file = File('python/_m5/param_%s.i' % name) 832 env.Command(i_file, Value(name), 833 MakeAction(createSimObjectSwigWrapper, Transform("SO SWIG"))) 834 env.Depends(i_file, depends + extra_deps) 835 SwigSource('_m5', i_file) 836 837# Generate the main swig init file 838def makeEmbeddedSwigInit(package): 839 def body(target, source, env): 840 assert len(target) == 1 and len(source) == 1 841 842 code = code_formatter() 843 module = source[0].get_contents() 844 # Provide the full context so that the swig-generated call to 845 # Py_InitModule ends up placing the embedded module in the 846 # right package. 847 context = str(package) + "._" + str(module) 848 code('''\ 849 #include "sim/init.hh" 850 851 extern "C" { 852 void init_${module}(); 853 } 854 855 EmbeddedSwig embed_swig_${module}(init_${module}, "${context}"); 856 ''') 857 code.write(str(target[0])) 858 return body 859 860# Build all swig modules 861for swig in SwigSource.all: 862 env.Command([swig.cc_source.tnode, swig.py_source.tnode], swig.tnode, 863 MakeAction('$SWIG $SWIGFLAGS -outdir ${TARGETS[1].dir} ' 864 '-o ${TARGETS[0]} $SOURCES', Transform("SWIG"))) 865 cc_file = str(swig.tnode) 866 init_file = '%s/%s_init.cc' % (dirname(cc_file), basename(cc_file)) 867 env.Command(init_file, Value(swig.module), 868 MakeAction(makeEmbeddedSwigInit(swig.package), 869 Transform("EMBED SW"))) 870 env.Depends(SWIG, init_file) 871 Source(init_file, **swig.guards) 872 | |
873# Build all protocol buffers if we have got protoc and protobuf available 874if env['HAVE_PROTOBUF']: 875 for proto in ProtoBuf.all: 876 # Use both the source and header as the target, and the .proto 877 # file as the source. When executing the protoc compiler, also 878 # specify the proto_path to avoid having the generated files 879 # include the path. 880 env.Command([proto.cc_file, proto.hh_file], proto.tnode, 881 MakeAction('$PROTOC --cpp_out ${TARGET.dir} ' 882 '--proto_path ${SOURCE.dir} $SOURCE', 883 Transform("PROTOC"))) 884 | 757# Build all protocol buffers if we have got protoc and protobuf available 758if env['HAVE_PROTOBUF']: 759 for proto in ProtoBuf.all: 760 # Use both the source and header as the target, and the .proto 761 # file as the source. When executing the protoc compiler, also 762 # specify the proto_path to avoid having the generated files 763 # include the path. 764 env.Command([proto.cc_file, proto.hh_file], proto.tnode, 765 MakeAction('$PROTOC --cpp_out ${TARGET.dir} ' 766 '--proto_path ${SOURCE.dir} $SOURCE', 767 Transform("PROTOC"))) 768 |
885 env.Depends(SWIG, [proto.cc_file, proto.hh_file]) | |
886 # Add the C++ source file 887 Source(proto.cc_file, **proto.guards) 888elif ProtoBuf.all: 889 print 'Got protobuf to build, but lacks support!' 890 Exit(1) 891 892# 893# Handle debug flags --- 83 unchanged lines hidden (view full) --- 977 978for name,flag in sorted(debug_flags.iteritems()): 979 n, compound, desc = flag 980 assert n == name 981 982 hh_file = 'debug/%s.hh' % name 983 env.Command(hh_file, Value(flag), 984 MakeAction(makeDebugFlagHH, Transform("TRACING", 0))) | 769 # Add the C++ source file 770 Source(proto.cc_file, **proto.guards) 771elif ProtoBuf.all: 772 print 'Got protobuf to build, but lacks support!' 773 Exit(1) 774 775# 776# Handle debug flags --- 83 unchanged lines hidden (view full) --- 860 861for name,flag in sorted(debug_flags.iteritems()): 862 n, compound, desc = flag 863 assert n == name 864 865 hh_file = 'debug/%s.hh' % name 866 env.Command(hh_file, Value(flag), 867 MakeAction(makeDebugFlagHH, Transform("TRACING", 0))) |
985 env.Depends(SWIG, hh_file) | |
986 987env.Command('debug/flags.cc', Value(debug_flags), 988 MakeAction(makeDebugFlagCC, Transform("TRACING", 0))) | 868 869env.Command('debug/flags.cc', Value(debug_flags), 870 MakeAction(makeDebugFlagCC, Transform("TRACING", 0))) |
989env.Depends(SWIG, 'debug/flags.cc') | |
990Source('debug/flags.cc') 991 992# version tags 993tags = \ 994env.Command('sim/tags.cc', None, 995 MakeAction('util/cpt_upgrader.py --get-cc-file > $TARGET', 996 Transform("VER TAGS"))) 997env.AlwaysBuild(tags) --- 49 unchanged lines hidden (view full) --- 1047 1048} // anonymous namespace 1049''') 1050 code.write(str(target[0])) 1051 1052for source in PySource.all: 1053 env.Command(source.cpp, source.tnode, 1054 MakeAction(embedPyFile, Transform("EMBED PY"))) | 871Source('debug/flags.cc') 872 873# version tags 874tags = \ 875env.Command('sim/tags.cc', None, 876 MakeAction('util/cpt_upgrader.py --get-cc-file > $TARGET', 877 Transform("VER TAGS"))) 878env.AlwaysBuild(tags) --- 49 unchanged lines hidden (view full) --- 928 929} // anonymous namespace 930''') 931 code.write(str(target[0])) 932 933for source in PySource.all: 934 env.Command(source.cpp, source.tnode, 935 MakeAction(embedPyFile, Transform("EMBED PY"))) |
1055 env.Depends(SWIG, source.cpp) | |
1056 Source(source.cpp, skip_no_python=True) 1057 1058######################################################################## 1059# 1060# Define binaries. Each different build type (debug, opt, etc.) gets 1061# a slightly different build environment. 1062# 1063 --- 18 unchanged lines hidden (view full) --- 1082 libname = variant('gem5_' + label) 1083 exename = variant('gem5.' + label) 1084 secondary_exename = variant('m5.' + label) 1085 1086 new_env = env.Clone(OBJSUFFIX=objsfx, SHOBJSUFFIX=objsfx + 's') 1087 new_env.Label = label 1088 new_env.Append(**kwargs) 1089 | 936 Source(source.cpp, skip_no_python=True) 937 938######################################################################## 939# 940# Define binaries. Each different build type (debug, opt, etc.) gets 941# a slightly different build environment. 942# 943 --- 18 unchanged lines hidden (view full) --- 962 libname = variant('gem5_' + label) 963 exename = variant('gem5.' + label) 964 secondary_exename = variant('m5.' + label) 965 966 new_env = env.Clone(OBJSUFFIX=objsfx, SHOBJSUFFIX=objsfx + 's') 967 new_env.Label = label 968 new_env.Append(**kwargs) 969 |
1090 swig_env = new_env.Clone() 1091 1092 # Both gcc and clang have issues with unused labels and values in 1093 # the SWIG generated code 1094 swig_env.Append(CCFLAGS=['-Wno-unused-label', '-Wno-unused-value']) 1095 | |
1096 if env['GCC']: | 970 if env['GCC']: |
1097 # Depending on the SWIG version, we also need to supress 1098 # warnings about uninitialized variables and missing field 1099 # initializers. 1100 swig_env.Append(CCFLAGS=['-Wno-uninitialized', 1101 '-Wno-missing-field-initializers', 1102 '-Wno-unused-but-set-variable', 1103 '-Wno-maybe-uninitialized', 1104 '-Wno-type-limits']) 1105 1106 | |
1107 # The address sanitizer is available for gcc >= 4.8 1108 if GetOption('with_asan'): 1109 if GetOption('with_ubsan') and \ 1110 compareVersions(env['GCC_VERSION'], '4.9') >= 0: 1111 new_env.Append(CCFLAGS=['-fsanitize=address,undefined', 1112 '-fno-omit-frame-pointer']) 1113 new_env.Append(LINKFLAGS='-fsanitize=address,undefined') 1114 else: --- 5 unchanged lines hidden (view full) --- 1120 # linker flags. 1121 elif GetOption('with_ubsan') and \ 1122 compareVersions(env['GCC_VERSION'], '4.9') >= 0: 1123 new_env.Append(CCFLAGS='-fsanitize=undefined') 1124 new_env.Append(LINKFLAGS='-fsanitize=undefined') 1125 1126 1127 if env['CLANG']: | 971 # The address sanitizer is available for gcc >= 4.8 972 if GetOption('with_asan'): 973 if GetOption('with_ubsan') and \ 974 compareVersions(env['GCC_VERSION'], '4.9') >= 0: 975 new_env.Append(CCFLAGS=['-fsanitize=address,undefined', 976 '-fno-omit-frame-pointer']) 977 new_env.Append(LINKFLAGS='-fsanitize=address,undefined') 978 else: --- 5 unchanged lines hidden (view full) --- 984 # linker flags. 985 elif GetOption('with_ubsan') and \ 986 compareVersions(env['GCC_VERSION'], '4.9') >= 0: 987 new_env.Append(CCFLAGS='-fsanitize=undefined') 988 new_env.Append(LINKFLAGS='-fsanitize=undefined') 989 990 991 if env['CLANG']: |
1128 swig_env.Append(CCFLAGS=['-Wno-sometimes-uninitialized', 1129 '-Wno-deprecated-register', 1130 '-Wno-tautological-compare']) 1131 | |
1132 # We require clang >= 3.1, so there is no need to check any 1133 # versions here. 1134 if GetOption('with_ubsan'): 1135 if GetOption('with_asan'): 1136 new_env.Append(CCFLAGS=['-fsanitize=address,undefined', 1137 '-fno-omit-frame-pointer']) 1138 new_env.Append(LINKFLAGS='-fsanitize=address,undefined') 1139 else: --- 13 unchanged lines hidden (view full) --- 1153 '-Wno-error=deprecated', 1154 ]) 1155 1156 def make_obj(source, static, extra_deps = None): 1157 '''This function adds the specified source to the correct 1158 build environment, and returns the corresponding SCons Object 1159 nodes''' 1160 | 992 # We require clang >= 3.1, so there is no need to check any 993 # versions here. 994 if GetOption('with_ubsan'): 995 if GetOption('with_asan'): 996 new_env.Append(CCFLAGS=['-fsanitize=address,undefined', 997 '-fno-omit-frame-pointer']) 998 new_env.Append(LINKFLAGS='-fsanitize=address,undefined') 999 else: --- 13 unchanged lines hidden (view full) --- 1013 '-Wno-error=deprecated', 1014 ]) 1015 1016 def make_obj(source, static, extra_deps = None): 1017 '''This function adds the specified source to the correct 1018 build environment, and returns the corresponding SCons Object 1019 nodes''' 1020 |
1161 if source.swig: 1162 env = swig_env 1163 elif source.Werror: | 1021 if source.Werror: |
1164 env = werror_env 1165 else: 1166 env = new_env 1167 1168 if static: 1169 obj = env.StaticObject(source.tnode) 1170 else: 1171 obj = env.SharedObject(source.tnode) 1172 1173 if extra_deps: 1174 env.Depends(obj, extra_deps) 1175 1176 return obj 1177 1178 lib_guards = {'main': False, 'skip_lib': False} 1179 | 1022 env = werror_env 1023 else: 1024 env = new_env 1025 1026 if static: 1027 obj = env.StaticObject(source.tnode) 1028 else: 1029 obj = env.SharedObject(source.tnode) 1030 1031 if extra_deps: 1032 env.Depends(obj, extra_deps) 1033 1034 return obj 1035 1036 lib_guards = {'main': False, 'skip_lib': False} 1037 |
1180 # Without Python, leave out all SWIG and Python content from the 1181 # library builds. The option doesn't affect gem5 built as a program | 1038 # Without Python, leave out all Python content from the library 1039 # builds. The option doesn't affect gem5 built as a program |
1182 if GetOption('without_python'): 1183 lib_guards['skip_no_python'] = False 1184 1185 static_objs = [] 1186 shared_objs = [] 1187 for s in guarded_source_iterator(Source.source_groups[None], **lib_guards): 1188 static_objs.append(make_obj(s, True)) 1189 shared_objs.append(make_obj(s, False)) --- 207 unchanged lines hidden --- | 1040 if GetOption('without_python'): 1041 lib_guards['skip_no_python'] = False 1042 1043 static_objs = [] 1044 shared_objs = [] 1045 for s in guarded_source_iterator(Source.source_groups[None], **lib_guards): 1046 static_objs.append(make_obj(s, True)) 1047 shared_objs.append(make_obj(s, False)) --- 207 unchanged lines hidden --- |