def earliestKnownWorkingRev(options, flags, skipRevs): ''' Returns a revset which evaluates to the first revision of the shell that compiles with |options| and runs jsfunfuzz successfully with |flags|. ''' assert (not sps.isMac) or (sps.macVer() >= [10, 10]) # Only support at least Mac OS X 10.10 # These should be in descending order, or bisection will break at earlier changesets. offthreadCompileFlag = gczealValueFlag = False # flags is a list of flags, and the option must exactly match. for entry in flags: # What comes after these flags needs to be a number, so we look for the string instead. if '--ion-offthread-compile=' in entry: offthreadCompileFlag = True elif '--gc-zeal=' in entry: gczealValueFlag = True required = [] if options.buildWithAsan: required.append('d4e0e0e5d26d') # m-c 268534 Fx44, 1st w/ reliable ASan builds w/ ICU, see bug 1214464 if "--ion-sincos=on" in flags: required.append('3dec2b935295') # m-c 262544 Fx43, 1st w/--ion-sincos=on, see bug 984018 if "--ion-instruction-reordering=on" in flags: required.append('59d2f2e62420') # m-c 259672 Fx43, 1st w/--ion-instruction-reordering=on, see bug 1195545 if "--ion-shared-stubs=on" in flags: required.append('3655d19ce241') # m-c 257573 Fx43, 1st w/--ion-shared-stubs=on, see bug 1168756 if options.enableSimulatorArm64: # This should get updated whenever ARM64 builds are stable, probably ~end-June 2015 required.append('25e99bc12482') # m-c 249239 Fx41, 1st w/--enable-simulator=[arm|arm64|mips], see bug 1173992 if "--ion-regalloc=testbed" in flags: required.append('47e92bae09fd') # m-c 248962 Fx41, 1st w/--ion-regalloc=testbed, see bug 1170840 if '--non-writable-jitcode' in flags: required.append('b46d6692fe50') # m-c 248578 Fx41, 1st w/--non-writable-jitcode, see bug 977805 if '--no-unboxed-objects' in flags: required.append('322487136b28') # m-c 244297 Fx41, 1st w/--no-unboxed-objects, see bug 1162199 if '--unboxed-arrays' in flags: required.append('020c6a559e3a') # m-c 242167 Fx40, 1st w/--unboxed-arrays, see bug 1146597 if '--ion-extra-checks' in flags: required.append('cdf93416b39a') # m-c 234228 Fx39, 1st w/--ion-extra-checks, see bug 1139152 if '--no-cgc' in flags: required.append('b63d7e80709a') # m-c 227705 Fx38, 1st w/--no-cgc, see bug 1126769 and see bug 1129233 if sps.isWin: required.append('8937836d3c93') # m-c 226774 Fx38, 1st w/ successful MSVC 2013 and 2015 builds, see bug 1119072 if sps.isLinux and float(platform.linux_distribution()[1]) > 15.04: required.append('bcacb5692ad9') # m-c 222786 Fx37, 1st w/ successful GCC 5.2.x builds on Ubuntu 15.10 onwards if sps.isLinux: required.append('6ec9033a4535') # m-c 217796 Fx36, previous builds fail on some Linux variants with different compiler versions if '--ion-sink=on' in flags: required.append('9188c8b7962b') # m-c 217242 Fx36, 1st w/--ion-sink=on, see bug 1093674 if gczealValueFlag: required.append('03c6a758c9e8') # m-c 216625 Fx36, 1st w/--gc-zeal=14, see bug 1101602 required.append('54be5416ae5d') # m-c 213474 Fx36, prior builds have issues with Xcode 7.0 and above return "first((" + commonDescendants(required) + ") - (" + skipRevs + "))"
def earliestKnownWorkingRev(options, flags, skipRevs): """Return a revset which evaluates to the first revision of the shell that compiles with |options| and runs jsfunfuzz successfully with |flags|.""" assert (not sps.isMac) or (sps.macVer() >= [10, 10]) # Only support at least Mac OS X 10.10 # These should be in descending order, or bisection will break at earlier changesets. gczealValueFlag = False # flags is a list of flags, and the option must exactly match. for entry in flags: # What comes after these flags needs to be a number, so we look for the string instead. if '--gc-zeal=' in entry: gczealValueFlag = True required = [] if options.buildWithClang and sps.isWin: required.append('3b26d191d84e') # m-c 316445 Fx52, 1st w/ reliable Clang 3.9.0 builds on Windows if "--ion-pgo=on" in flags: required.append('b0a0ff5fa705') # m-c 272274 Fx45, 1st w/--ion-pgo=on, see bug 1209515 if options.buildWithAsan: required.append('d4e0e0e5d26d') # m-c 268534 Fx44, 1st w/ reliable ASan builds w/ ICU, see bug 1214464 if "--ion-sincos=on" in flags: required.append('3dec2b935295') # m-c 262544 Fx43, 1st w/--ion-sincos=on, see bug 984018 if "--ion-instruction-reordering=on" in flags: required.append('59d2f2e62420') # m-c 259672 Fx43, 1st w/--ion-instruction-reordering=on, see bug 1195545 if "--ion-shared-stubs=on" in flags: required.append('3655d19ce241') # m-c 257573 Fx43, 1st w/--ion-shared-stubs=on, see bug 1168756 if options.enableSimulatorArm32 or options.enableSimulatorArm64: # For ARM64: This should get updated whenever ARM64 builds are stable, probably ~end-June 2015 # To bisect manually slightly further, use "-s dc4b163f7db7 -e f50a771d7d1b" and: # Also comment out from https://github.com/MozillaSecurity/funfuzz/blob/bbc5d5c74dc96823ed3932eed1ab18c299bd806c/autobisect-js/autoBisect.py#L176 # (line 176) to line 180. required.append('25e99bc12482') # m-c 249239 Fx41, 1st w/--enable-simulator=[arm|arm64|mips], see bug 1173992 if "--ion-regalloc=testbed" in flags: required.append('47e92bae09fd') # m-c 248962 Fx41, 1st w/--ion-regalloc=testbed, see bug 1170840 if '--non-writable-jitcode' in flags: required.append('b46d6692fe50') # m-c 248578 Fx41, 1st w/--non-writable-jitcode, see bug 977805 if '--no-unboxed-objects' in flags: required.append('322487136b28') # m-c 244297 Fx41, 1st w/--no-unboxed-objects, see bug 1162199 if '--unboxed-arrays' in flags: required.append('020c6a559e3a') # m-c 242167 Fx40, 1st w/--unboxed-arrays, see bug 1146597 if '--ion-extra-checks' in flags: required.append('cdf93416b39a') # m-c 234228 Fx39, 1st w/--ion-extra-checks, see bug 1139152 if '--no-cgc' in flags: required.append('b63d7e80709a') # m-c 227705 Fx38, 1st w/--no-cgc, see bug 1126769 and see bug 1129233 if sps.isWin: required.append('8937836d3c93') # m-c 226774 Fx38, 1st w/ successful MSVC 2015 builds, see bug 1119072 if sps.isLinux: required.append('bcacb5692ad9') # m-c 222786 Fx37, 1st w/ successful GCC 5.2.x builds on Ubuntu 15.10 onwards if '--ion-sink=on' in flags: required.append('9188c8b7962b') # m-c 217242 Fx36, 1st w/--ion-sink=on, see bug 1093674 if gczealValueFlag: required.append('03c6a758c9e8') # m-c 216625 Fx36, 1st w/--gc-zeal=14, see bug 1101602 required.append('dc4b163f7db7') # m-c 213475 Fx36, prior builds have issues with Xcode 7.0 and above return "first((" + commonDescendants(required) + ") - (" + skipRevs + "))"
def cfgBin(shell, binToBeCompiled): '''This function configures a binary according to required parameters.''' cfgCmdList = [] cfgEnvDt = copy.deepcopy(os.environ) origCfgEnvDt = copy.deepcopy(os.environ) cfgEnvDt['AR'] = 'ar' # Check for determinism to prevent LLVM compilation from happening on releng machines, # since releng machines only test non-deterministic builds. if shell.buildOptions.buildWithAsan and shell.buildOptions.enableMoreDeterministic: llvmPath = envVars.findLlvmBinPath() assert llvmPath is not None CLANG_PATH = sps.normExpUserPath(os.path.join(llvmPath, 'clang')) CLANGPP_PATH = sps.normExpUserPath(os.path.join(llvmPath, 'clang++')) if sps.isARMv7l: # 32-bit shell on ARM boards, e.g. odroid boards. # This is tested on Ubuntu 14.04 with necessary armel libraries (force)-installed. assert shell.buildOptions.enable32, 'arm7vl boards are only 32-bit, armv8 boards will be 64-bit.' if not shell.buildOptions.enableHardFp: cfgEnvDt['CC'] = 'gcc-4.7 -mfloat-abi=softfp -B/usr/lib/gcc/arm-linux-gnueabi/4.7' cfgEnvDt['CXX'] = 'g++-4.7 -mfloat-abi=softfp -B/usr/lib/gcc/arm-linux-gnueabi/4.7' cfgCmdList.append('sh') if binToBeCompiled == 'nspr': cfgCmdList.append(os.path.normpath(shell.getNsprCfgPath())) else: cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) # From mjrosenb: things might go wrong if these three lines are not present for # compiling ARM on a 64-bit host machine. Not needed if compiling on the board itself. # cfgCmdList.append('--target=arm-linux-gnueabi') # cfgCmdList.append('--with-arch=armv7-a') # cfgCmdList.append('--with-thumb') if not shell.buildOptions.enableHardFp: cfgCmdList.append('--target=arm-linux-gnueabi') elif shell.buildOptions.enable32 and os.name == 'posix': # 32-bit shell on Mac OS X 10.7 Lion and greater if sps.isMac: assert sps.macVer() >= [10, 7] # We no longer support Snow Leopard 10.6 and prior. if shell.buildOptions.buildWithAsan: # Uses custom compiled clang cfgEnvDt['CC'] = cfgEnvDt['HOST_CC'] = CLANG_PATH + CLANG_PARAMS + \ CLANG_ASAN_PARAMS + SSE2_FLAGS cfgEnvDt['CXX'] = cfgEnvDt['HOST_CXX'] = CLANGPP_PATH + CLANG_PARAMS + \ CLANG_ASAN_PARAMS + SSE2_FLAGS else: # Uses system clang cfgEnvDt['CC'] = cfgEnvDt['HOST_CC'] = 'clang' + CLANG_PARAMS + SSE2_FLAGS cfgEnvDt['CXX'] = cfgEnvDt['HOST_CXX'] = 'clang++' + CLANG_PARAMS + SSE2_FLAGS cfgEnvDt['CC'] = cfgEnvDt['CC'] + CLANG_X86_FLAG # only needed for CC, not HOST_CC cfgEnvDt['CXX'] = cfgEnvDt['CXX'] + CLANG_X86_FLAG # only needed for CXX, not HOST_CXX cfgEnvDt['RANLIB'] = 'ranlib' cfgEnvDt['AS'] = '$CC' cfgEnvDt['LD'] = 'ld' cfgEnvDt['STRIP'] = 'strip -x -S' cfgEnvDt['CROSS_COMPILE'] = '1' if sps.isProgramInstalled('brew'): cfgEnvDt['AUTOCONF'] = '/usr/local/Cellar/autoconf213/2.13/bin/autoconf213' cfgCmdList.append('sh') if binToBeCompiled == 'nspr': cfgCmdList.append(os.path.normpath(shell.getNsprCfgPath())) else: cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) cfgCmdList.append('--target=i386-apple-darwin9.2.0') # Leopard 10.5.2 cfgCmdList.append('--enable-macos-target=10.5') if shell.buildOptions.buildWithAsan: cfgCmdList.append('--enable-address-sanitizer') if shell.buildOptions.enableSimulatorArm32: # --enable-arm-simulator became --enable-simulator=arm in rev 25e99bc12482 # but unknown flags are ignored, so we compile using both till Fx38 ESR is deprecated cfgCmdList.append('--enable-arm-simulator') cfgCmdList.append('--enable-simulator=arm') # 32-bit shell on 32/64-bit x86 Linux elif sps.isLinux and not sps.isARMv7l: cfgEnvDt['PKG_CONFIG_LIBDIR'] = '/usr/lib/pkgconfig' if shell.buildOptions.buildWithAsan: # Uses custom compiled clang cfgEnvDt['CC'] = cfgEnvDt['HOST_CC'] = CLANG_PATH + CLANG_PARAMS + \ CLANG_ASAN_PARAMS + SSE2_FLAGS + CLANG_X86_FLAG cfgEnvDt['CXX'] = cfgEnvDt['HOST_CXX'] = CLANGPP_PATH + CLANG_PARAMS + \ CLANG_ASAN_PARAMS + SSE2_FLAGS + CLANG_X86_FLAG else: # Uses system clang # We might still be using GCC on Linux 32-bit, use clang only if we specify ASan # apt-get `lib32z1 gcc-multilib g++-multilib` first, if on 64-bit Linux. cfgEnvDt['CC'] = 'gcc -m32' + SSE2_FLAGS cfgEnvDt['CXX'] = 'g++ -m32' + SSE2_FLAGS cfgCmdList.append('sh') if binToBeCompiled == 'nspr': cfgCmdList.append(os.path.normpath(shell.getNsprCfgPath())) else: cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) cfgCmdList.append('--target=i686-pc-linux') if shell.buildOptions.buildWithAsan: cfgCmdList.append('--enable-address-sanitizer') if shell.buildOptions.enableSimulatorArm32: # --enable-arm-simulator became --enable-simulator=arm in rev 25e99bc12482 # but unknown flags are ignored, so we compile using both till Fx38 ESR is deprecated cfgCmdList.append('--enable-arm-simulator') cfgCmdList.append('--enable-simulator=arm') else: cfgCmdList.append('sh') if binToBeCompiled == 'nspr': cfgCmdList.append(os.path.normpath(shell.getNsprCfgPath())) else: cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) # 64-bit shell on Mac OS X 10.7 Lion and greater elif sps.isMac and sps.macVer() >= [10, 7] and not shell.buildOptions.enable32: if shell.buildOptions.buildWithAsan: # Uses custom compiled clang cfgEnvDt['CC'] = CLANG_PATH + CLANG_PARAMS + CLANG_ASAN_PARAMS cfgEnvDt['CXX'] = CLANGPP_PATH + CLANG_PARAMS + CLANG_ASAN_PARAMS else: # Uses system clang cfgEnvDt['CC'] = 'clang' + CLANG_PARAMS cfgEnvDt['CXX'] = 'clang++' + CLANG_PARAMS if sps.isProgramInstalled('brew'): cfgEnvDt['AUTOCONF'] = '/usr/local/Cellar/autoconf213/2.13/bin/autoconf213' cfgCmdList.append('sh') if binToBeCompiled == 'nspr': cfgCmdList.append(os.path.normpath(shell.getNsprCfgPath())) cfgCmdList.append('--enable-64bit') else: cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) cfgCmdList.append('--target=x86_64-apple-darwin12.5.0') # Mountain Lion 10.8.5 if shell.buildOptions.buildWithAsan: cfgCmdList.append('--enable-address-sanitizer') if shell.buildOptions.enableSimulatorArm64: cfgCmdList.append('--enable-simulator=arm64') elif sps.isWin: cfgEnvDt['MAKE'] = 'mozmake' # Workaround for bug 948534 cfgCmdList.append('sh') if binToBeCompiled == 'nspr': cfgCmdList.append(os.path.normpath(shell.getNsprCfgPath())) if shell.buildOptions.enable32: cfgCmdList.append('--enable-win32-target=WIN95') else: cfgCmdList.append('--enable-64bit') else: cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) if shell.buildOptions.enable32: if shell.buildOptions.enableSimulatorArm32: # --enable-arm-simulator became --enable-simulator=arm in rev 25e99bc12482 # but unknown flags are ignored, so we compile using both till Fx38 ESR is deprecated cfgCmdList.append('--enable-arm-simulator') cfgCmdList.append('--enable-simulator=arm') else: cfgCmdList.append('--host=x86_64-pc-mingw32') cfgCmdList.append('--target=x86_64-pc-mingw32') if shell.buildOptions.enableSimulatorArm64: cfgCmdList.append('--enable-simulator=arm64') else: # We might still be using GCC on Linux 64-bit, so do not use clang unless Asan is specified if shell.buildOptions.buildWithAsan: # Uses custom compiled clang cfgEnvDt['CC'] = CLANG_PATH + CLANG_PARAMS + CLANG_ASAN_PARAMS cfgEnvDt['CXX'] = CLANGPP_PATH + CLANG_PARAMS + CLANG_ASAN_PARAMS cfgCmdList.append('sh') if binToBeCompiled == 'nspr': cfgCmdList.append(os.path.normpath(shell.getNsprCfgPath())) cfgCmdList.append('--enable-64bit') else: cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) if shell.buildOptions.buildWithAsan: cfgCmdList.append('--enable-address-sanitizer') if shell.buildOptions.buildWithAsan: assert 'clang' in cfgEnvDt['CC'] assert 'clang++' in cfgEnvDt['CXX'] cfgCmdList.append('--disable-jemalloc') # See bug 1146895 # For NSPR, specify "--disable-debug --enable-optimize" to generate an opt build. # They can actually be used independently, but it's not recommended. # https://developer.mozilla.org/en-US/docs/NSPR_build_instructions#Configure_options if shell.buildOptions.enableDbg: # NSPR configure without options compiles debug by default if binToBeCompiled == 'js': cfgCmdList.append('--enable-debug') elif shell.buildOptions.disableDbg or binToBeCompiled == 'nspr': cfgCmdList.append('--disable-debug') if shell.buildOptions.enableOpt: cfgCmdList.append('--enable-optimize' + ('=-O1' if shell.buildOptions.buildWithVg else '')) elif binToBeCompiled == 'js' and shell.buildOptions.disableOpt: # NSPR configure without options compiles debug by default cfgCmdList.append('--disable-optimize') if binToBeCompiled == 'nspr': cfgCmdList.append('--prefix=' + sps.normExpUserPath(os.path.join(shell.getNsprObjdir(), 'dist'))) else: if shell.buildOptions.enableProfiling: cfgCmdList.append('--enable-profiling') if shell.getJsUsesNoThreadsFlag() and shell.buildOptions.enableNsprBuild: cfgCmdList.append('--enable-nspr-build') else: if shell.buildOptions.enableNsprBuild: cfgCmdList.append('--enable-threadsafe') if not shell.getJsBuildSystemConsidersNspr(): cfgCmdList.append('--with-nspr-prefix=' + sps.normExpUserPath(os.path.join(shell.getNsprObjdir(), 'dist'))) cfgCmdList.append('--with-nspr-cflags=-I' + sps.normExpUserPath(os.path.join(shell.getNsprObjdir(), 'dist', 'include', 'nspr'))) cfgCmdList.append('--with-nspr-libs=' + ' '.join([ sps.normExpUserPath(os.path.join(shell.getNsprObjdir(), 'dist', 'lib', compileLib)) for compileLib in inspectShell.ALL_COMPILE_LIBS ])) else: cfgCmdList.append('--disable-threadsafe') if shell.buildOptions.enableMoreDeterministic: # Fuzzing tweaks for more useful output, implemented in bug 706433 cfgCmdList.append('--enable-more-deterministic') if shell.buildOptions.buildWithVg: cfgCmdList.append('--enable-valgrind') cfgCmdList.append('--disable-jemalloc') # We add the following flags by default. if os.name == 'posix': cfgCmdList.append('--with-ccache') cfgCmdList.append('--enable-gczeal') cfgCmdList.append('--enable-debug-symbols') # gets debug symbols on opt shells cfgCmdList.append('--disable-tests') if os.name == 'nt': # FIXME: Replace this with sps.shellify. counter = 0 for entry in cfgCmdList: if os.sep in entry: assert sps.isWin # MozillaBuild on Windows sometimes confuses "/" and "\". cfgCmdList[counter] = cfgCmdList[counter].replace(os.sep, '//') counter = counter + 1 # Print whatever we added to the environment envVarList = [] for envVar in set(cfgEnvDt.keys()) - set(origCfgEnvDt.keys()): strToBeAppended = envVar + '="' + cfgEnvDt[envVar] + '"' \ if ' ' in cfgEnvDt[envVar] else envVar + '=' + cfgEnvDt[envVar] envVarList.append(strToBeAppended) sps.vdump('Command to be run is: ' + sps.shellify(envVarList) + ' ' + sps.shellify(cfgCmdList)) wDir = shell.getNsprObjdir() if binToBeCompiled == 'nspr' else shell.getJsObjdir() assert os.path.isdir(wDir) if sps.isWin: changedCfgCmdList = [] for entry in cfgCmdList: # See bug 986715 comment 6 as to why we need forward slashes for NSPR # For JS, quoted from :glandium: "the way icu subconfigure is called is what changed. # but really, the whole thing likes forward slashes way better" # See bug 1038590 comment 9. if '\\' in entry: entry = entry.replace('\\', '/') changedCfgCmdList.append(entry) sps.captureStdout(changedCfgCmdList, ignoreStderr=True, currWorkingDir=wDir, env=cfgEnvDt) else: sps.captureStdout(cfgCmdList, ignoreStderr=True, currWorkingDir=wDir, env=cfgEnvDt) shell.setEnvAdded(envVarList) shell.setEnvFull(cfgEnvDt) shell.setCfgCmdExclEnv(cfgCmdList)
def cfgBin(shell): """Configure a binary according to required parameters.""" cfgCmdList = [] cfgEnvDt = copy.deepcopy(os.environ) origCfgEnvDt = copy.deepcopy(os.environ) cfgEnvDt[b"AR"] = b"ar" if sps.isARMv7l: # 32-bit shell on ARM boards, e.g. odroid boards. # This is tested on Ubuntu 14.04 with necessary armel libraries (force)-installed. assert shell.buildOptions.enable32, 'arm7vl boards are only 32-bit, armv8 boards will be 64-bit.' if not shell.buildOptions.enableHardFp: cfgEnvDt[b"CC"] = b"gcc-4.7 -mfloat-abi=softfp -B/usr/lib/gcc/arm-linux-gnueabi/4.7" cfgEnvDt[b"CXX"] = b"g++-4.7 -mfloat-abi=softfp -B/usr/lib/gcc/arm-linux-gnueabi/4.7" cfgCmdList.append('sh') cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) # From mjrosenb: things might go wrong if these three lines are not present for # compiling ARM on a 64-bit host machine. Not needed if compiling on the board itself. # cfgCmdList.append('--target=arm-linux-gnueabi') # cfgCmdList.append('--with-arch=armv7-a') # cfgCmdList.append('--with-thumb') if not shell.buildOptions.enableHardFp: cfgCmdList.append('--target=arm-linux-gnueabi') elif shell.buildOptions.enable32 and os.name == 'posix': # 32-bit shell on Mac OS X 10.10 Yosemite and greater if sps.isMac: assert sps.macVer() >= [10, 10] # We no longer support 10.9 Mavericks and prior. # Uses system clang cfgEnvDt[b"CC"] = cfgEnvDt[b"HOST_CC"] = b"clang %s %s" % (CLANG_PARAMS, SSE2_FLAGS) cfgEnvDt[b"CXX"] = cfgEnvDt[b"HOST_CXX"] = b"clang++ %s %s" % (CLANG_PARAMS, SSE2_FLAGS) if shell.buildOptions.buildWithAsan: cfgEnvDt[b"CC"] += b" " + CLANG_ASAN_PARAMS cfgEnvDt[b"CXX"] += b" " + CLANG_ASAN_PARAMS cfgEnvDt[b"CC"] += b" " + CLANG_X86_FLAG # only needed for CC, not HOST_CC cfgEnvDt[b"CXX"] += b" " + CLANG_X86_FLAG # only needed for CXX, not HOST_CXX cfgEnvDt[b"RANLIB"] = b"ranlib" cfgEnvDt[b"AS"] = b"$CC" cfgEnvDt[b"LD"] = b"ld" cfgEnvDt[b"STRIP"] = b"strip -x -S" cfgEnvDt[b"CROSS_COMPILE"] = b"1" if sps.isProgramInstalled('brew'): cfgEnvDt[b"AUTOCONF"] = b"/usr/local/Cellar/autoconf213/2.13/bin/autoconf213" # Hacked up for new and old Homebrew configs, we can probably just call autoconf213 if not os.path.isfile(sps.normExpUserPath(cfgEnvDt[b"AUTOCONF"])): cfgEnvDt[b"AUTOCONF"] = b"autoconf213" cfgCmdList.append('sh') cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) cfgCmdList.append('--target=i386-apple-darwin14.5.0') # Yosemite 10.10.5 if shell.buildOptions.buildWithAsan: cfgCmdList.append('--enable-address-sanitizer') if shell.buildOptions.enableSimulatorArm32: # --enable-arm-simulator became --enable-simulator=arm in rev 25e99bc12482 # but unknown flags are ignored, so we compile using both till Fx38 ESR is deprecated # Newer configure.in changes mean that things blow up if unknown/removed configure # options are entered, so specify it only if it's requested. if shell.buildOptions.enableArmSimulatorObsolete: cfgCmdList.append('--enable-arm-simulator') cfgCmdList.append('--enable-simulator=arm') # 32-bit shell on 32/64-bit x86 Linux elif sps.isLinux and not sps.isARMv7l: cfgEnvDt[b"PKG_CONFIG_LIBDIR"] = b"/usr/lib/pkgconfig" if shell.buildOptions.buildWithClang: cfgEnvDt[b"CC"] = cfgEnvDt[b"HOST_CC"] = str( "clang %s %s %s" % (CLANG_PARAMS, SSE2_FLAGS, CLANG_X86_FLAG)) cfgEnvDt[b"CXX"] = cfgEnvDt[b"HOST_CXX"] = str( "clang++ %s %s %s" % (CLANG_PARAMS, SSE2_FLAGS, CLANG_X86_FLAG)) else: # apt-get `lib32z1 gcc-multilib g++-multilib` first, if on 64-bit Linux. cfgEnvDt[b"CC"] = b"gcc -m32 %s" % SSE2_FLAGS cfgEnvDt[b"CXX"] = b"g++ -m32 %s" % SSE2_FLAGS if shell.buildOptions.buildWithAsan: cfgEnvDt[b"CC"] += b" " + CLANG_ASAN_PARAMS cfgEnvDt[b"CXX"] += b" " + CLANG_ASAN_PARAMS cfgCmdList.append('sh') cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) cfgCmdList.append('--target=i686-pc-linux') if shell.buildOptions.buildWithAsan: cfgCmdList.append('--enable-address-sanitizer') if shell.buildOptions.enableSimulatorArm32: # --enable-arm-simulator became --enable-simulator=arm in rev 25e99bc12482 # but unknown flags are ignored, so we compile using both till Fx38 ESR is deprecated # Newer configure.in changes mean that things blow up if unknown/removed configure # options are entered, so specify it only if it's requested. if shell.buildOptions.enableArmSimulatorObsolete: cfgCmdList.append('--enable-arm-simulator') cfgCmdList.append('--enable-simulator=arm') else: cfgCmdList.append('sh') cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) # 64-bit shell on Mac OS X 10.10 Yosemite and greater elif sps.isMac and sps.macVer() >= [10, 10] and not shell.buildOptions.enable32: cfgEnvDt[b"CC"] = b"clang " + CLANG_PARAMS cfgEnvDt[b"CXX"] = b"clang++ " + CLANG_PARAMS if shell.buildOptions.buildWithAsan: cfgEnvDt[b"CC"] += b" " + CLANG_ASAN_PARAMS cfgEnvDt[b"CXX"] += b" " + CLANG_ASAN_PARAMS if sps.isProgramInstalled('brew'): cfgEnvDt[b"AUTOCONF"] = b"/usr/local/Cellar/autoconf213/2.13/bin/autoconf213" cfgCmdList.append('sh') cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) cfgCmdList.append('--target=x86_64-apple-darwin14.5.0') # Yosemite 10.10.5 if shell.buildOptions.buildWithAsan: cfgCmdList.append('--enable-address-sanitizer') if shell.buildOptions.enableSimulatorArm64: cfgCmdList.append('--enable-simulator=arm64') elif sps.isWin: cfgEnvDt[b"MAKE"] = b"mozmake" # Workaround for bug 948534 if shell.buildOptions.buildWithClang: cfgEnvDt[b"CC"] = b"clang-cl.exe " + CLANG_PARAMS cfgEnvDt[b"CXX"] = b"clang-cl.exe " + CLANG_PARAMS if shell.buildOptions.buildWithAsan: cfgEnvDt[b"CFLAGS"] = CLANG_ASAN_PARAMS cfgEnvDt[b"CXXFLAGS"] = CLANG_ASAN_PARAMS cfgEnvDt[b"LDFLAGS"] = (b"clang_rt.asan_dynamic-x86_64.lib " b"clang_rt.asan_dynamic_runtime_thunk-x86_64.lib " b"clang_rt.asan_dynamic-x86_64.dll") cfgEnvDt[b"HOST_CFLAGS"] = b" " cfgEnvDt[b"HOST_CXXFLAGS"] = b" " cfgEnvDt[b"HOST_LDFLAGS"] = b" " cfgEnvDt[b"LIB"] += br"C:\Program Files\LLVM\lib\clang\4.0.0\lib\windows" cfgCmdList.append('sh') cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) if shell.buildOptions.enable32: if shell.buildOptions.enableSimulatorArm32: # --enable-arm-simulator became --enable-simulator=arm in rev 25e99bc12482 # but unknown flags are ignored, so we compile using both till Fx38 ESR is deprecated # Newer configure.in changes mean that things blow up if unknown/removed configure # options are entered, so specify it only if it's requested. if shell.buildOptions.enableArmSimulatorObsolete: cfgCmdList.append('--enable-arm-simulator') cfgCmdList.append('--enable-simulator=arm') else: cfgCmdList.append('--host=x86_64-pc-mingw32') cfgCmdList.append('--target=x86_64-pc-mingw32') if shell.buildOptions.enableSimulatorArm64: cfgCmdList.append('--enable-simulator=arm64') if shell.buildOptions.buildWithAsan: cfgCmdList.append('--enable-address-sanitizer') else: # We might still be using GCC on Linux 64-bit, so do not use clang unless Asan is specified if shell.buildOptions.buildWithClang: cfgEnvDt[b"CC"] = b"clang " + CLANG_PARAMS cfgEnvDt[b"CXX"] = b"clang++ " + CLANG_PARAMS if shell.buildOptions.buildWithAsan: cfgEnvDt[b"CC"] += b" " + CLANG_ASAN_PARAMS cfgEnvDt[b"CXX"] += b" " + CLANG_ASAN_PARAMS cfgCmdList.append('sh') cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) if shell.buildOptions.buildWithAsan: cfgCmdList.append('--enable-address-sanitizer') if shell.buildOptions.buildWithClang: if sps.isWin: assert b"clang-cl" in cfgEnvDt[b"CC"] assert b"clang-cl" in cfgEnvDt[b"CXX"] else: assert b"clang" in cfgEnvDt[b"CC"] assert b"clang++" in cfgEnvDt[b"CXX"] cfgCmdList.append('--disable-jemalloc') # See bug 1146895 if shell.buildOptions.enableDbg: cfgCmdList.append('--enable-debug') elif shell.buildOptions.disableDbg: cfgCmdList.append('--disable-debug') if shell.buildOptions.enableOpt: cfgCmdList.append('--enable-optimize' + ('=-O1' if shell.buildOptions.buildWithVg else '')) elif shell.buildOptions.disableOpt: cfgCmdList.append('--disable-optimize') if shell.buildOptions.enableProfiling: # Now obsolete, retained for backward compatibility cfgCmdList.append('--enable-profiling') if shell.buildOptions.disableProfiling: cfgCmdList.append('--disable-profiling') if shell.buildOptions.enableMoreDeterministic: # Fuzzing tweaks for more useful output, implemented in bug 706433 cfgCmdList.append('--enable-more-deterministic') if shell.buildOptions.enableOomBreakpoint: # Extra debugging help for OOM assertions cfgCmdList.append('--enable-oom-breakpoint') if shell.buildOptions.enableWithoutIntlApi: # Speeds up compilation but is non-default cfgCmdList.append('--without-intl-api') if shell.buildOptions.buildWithVg: cfgCmdList.append('--enable-valgrind') cfgCmdList.append('--disable-jemalloc') # We add the following flags by default. if os.name == 'posix': cfgCmdList.append('--with-ccache') cfgCmdList.append('--enable-gczeal') cfgCmdList.append('--enable-debug-symbols') # gets debug symbols on opt shells cfgCmdList.append('--disable-tests') if os.name == 'nt': # FIXME: Replace this with sps.shellify. counter = 0 for entry in cfgCmdList: if os.sep in entry: assert sps.isWin # MozillaBuild on Windows sometimes confuses "/" and "\". cfgCmdList[counter] = cfgCmdList[counter].replace(os.sep, '//') counter = counter + 1 # Print whatever we added to the environment envVarList = [] for envVar in set(cfgEnvDt.keys()) - set(origCfgEnvDt.keys()): strToBeAppended = str(envVar + '="' + cfgEnvDt[str(envVar)] + '"' if " " in cfgEnvDt[str(envVar)] else envVar + "=" + cfgEnvDt[str(envVar)]) envVarList.append(strToBeAppended) sps.vdump('Command to be run is: ' + sps.shellify(envVarList) + ' ' + sps.shellify(cfgCmdList)) wDir = shell.getJsObjdir() assert os.path.isdir(wDir) if sps.isWin: changedCfgCmdList = [] for entry in cfgCmdList: # For JS, quoted from :glandium: "the way icu subconfigure is called is what changed. # but really, the whole thing likes forward slashes way better" # See bug 1038590 comment 9. if '\\' in entry: entry = entry.replace('\\', '/') changedCfgCmdList.append(entry) sps.captureStdout(changedCfgCmdList, ignoreStderr=True, currWorkingDir=wDir, env=cfgEnvDt) else: sps.captureStdout(cfgCmdList, ignoreStderr=True, currWorkingDir=wDir, env=cfgEnvDt) shell.setEnvAdded(envVarList) shell.setEnvFull(cfgEnvDt) shell.setCfgCmdExclEnv(cfgCmdList)
def earliestKnownWorkingRev(options, flags, skipRevs): """Return a revset which evaluates to the first revision of the shell that compiles with |options| and runs jsfunfuzz successfully with |flags|.""" assert (not sps.isMac) or (sps.macVer() >= [10, 10] ) # Only support at least Mac OS X 10.10 # These should be in descending order, or bisection will break at earlier changesets. gczealValueFlag = False # flags is a list of flags, and the option must exactly match. for entry in flags: # What comes after these flags needs to be a number, so we look for the string instead. if '--gc-zeal=' in entry: gczealValueFlag = True required = [] # Note that the sed version check only works with GNU sed, not BSD sed found in macOS. if sps.isLinux and StrictVersion( sps.verCheck('sed').split()[3]) >= StrictVersion('4.3'): required.append( 'ebcbf47a83e7' ) # m-c 328765 Fx53, 1st w/ working builds using sed 4.3+ found on Ubuntu 17.04 onwards if options.disableProfiling: required.append( '800a887c705e' ) # m-c 324836 Fx53, 1st w/ --disable-profiling, see bug 1321065 if options.buildWithClang and sps.isWin: required.append( '3b26d191d84e' ) # m-c 316445 Fx52, 1st w/ reliable Clang 3.9.0 builds on Windows if "--wasm-always-baseline" in flags: required.append( '893294e2a387' ) # m-c 301769 Fx50, 1st w/--wasm-always-baseline, see bug 1232205 if '--ion-aa=flow-sensitive' in flags or '--ion-aa=flow-insensitive' in flags: # m-c 295435 Fx49, 1st w/--ion-aa=[flow-sensitive|flow-insensitive], see bug 1255008 required.append('c0c1d923c292') if "--ion-pgo=on" in flags: required.append( 'b0a0ff5fa705' ) # m-c 272274 Fx45, 1st w/--ion-pgo=on, see bug 1209515 if options.buildWithAsan: required.append( 'd4e0e0e5d26d' ) # m-c 268534 Fx44, 1st w/ reliable ASan builds w/ ICU, see bug 1214464 if "--ion-sincos=on" in flags: required.append( '3dec2b935295' ) # m-c 262544 Fx43, 1st w/--ion-sincos=on, see bug 984018 if "--ion-instruction-reordering=on" in flags: required.append( '59d2f2e62420' ) # m-c 259672 Fx43, 1st w/--ion-instruction-reordering=on, see bug 1195545 if "--ion-shared-stubs=on" in flags: required.append( '3655d19ce241' ) # m-c 257573 Fx43, 1st w/--ion-shared-stubs=on, see bug 1168756 if options.enableSimulatorArm32 or options.enableSimulatorArm64: # For ARM64: This should get updated whenever ARM64 builds are stable, probably ~end-June 2015 # To bisect manually slightly further, use "-s dc4b163f7db7 -e f50a771d7d1b" and: # Also comment out from https://github.com/MozillaSecurity/funfuzz/blob/bbc5d5c74dc96823ed3932eed1ab18c299bd806c/autobisect-js/autoBisect.py#L176 # (line 176) to line 180. required.append( '25e99bc12482' ) # m-c 249239 Fx41, 1st w/--enable-simulator=[arm|arm64|mips], see bug 1173992 if "--ion-regalloc=testbed" in flags: required.append( '47e92bae09fd' ) # m-c 248962 Fx41, 1st w/--ion-regalloc=testbed, see bug 1170840 if '--non-writable-jitcode' in flags: required.append( 'b46d6692fe50' ) # m-c 248578 Fx41, 1st w/--non-writable-jitcode, see bug 977805 if '--no-unboxed-objects' in flags: required.append( '322487136b28' ) # m-c 244297 Fx41, 1st w/--no-unboxed-objects, see bug 1162199 if '--unboxed-arrays' in flags: required.append( '020c6a559e3a' ) # m-c 242167 Fx40, 1st w/--unboxed-arrays, see bug 1146597 if '--ion-extra-checks' in flags: required.append( 'cdf93416b39a' ) # m-c 234228 Fx39, 1st w/--ion-extra-checks, see bug 1139152 if '--no-cgc' in flags: required.append( 'b63d7e80709a' ) # m-c 227705 Fx38, 1st w/--no-cgc, see bug 1126769 and see bug 1129233 if sps.isWin: required.append( '8937836d3c93' ) # m-c 226774 Fx38, 1st w/ successful MSVC 2015 builds, see bug 1119072 if sps.isLinux: required.append( 'bcacb5692ad9' ) # m-c 222786 Fx37, 1st w/ successful GCC 5.2.x builds on Ubuntu 15.10 onwards if '--ion-sink=on' in flags: required.append( '9188c8b7962b' ) # m-c 217242 Fx36, 1st w/--ion-sink=on, see bug 1093674 if gczealValueFlag: required.append( '03c6a758c9e8' ) # m-c 216625 Fx36, 1st w/--gc-zeal=14, see bug 1101602 required.append( 'dc4b163f7db7' ) # m-c 213475 Fx36, prior builds have issues with Xcode 7.0 and above return "first((" + commonDescendants(required) + ") - (" + skipRevs + "))"
def earliestKnownWorkingRevForBrowser(options): if sps.isMac and sps.macVer() >= [10, 9]: return '1c4ac1d21d29' # beacc621ec68 fixed 10.9 builds, but landed in the middle of unrelated bustage return '4e852ca66ea0' # or 'd97862fb8e6d' (same as js below) ... either way, oct 2012 on mac :(
def earliestKnownWorkingRev(options, flags, skipRevs): ''' Returns a revset which evaluates to the first revision of the shell that compiles with |options| and runs jsfunfuzz successfully with |flags|. ''' assert (not sps.isMac) or ( sps.macVer() >= [10, 7] ) # Only Lion and above are supported with Clang 4. # These should be in descending order, or bisection will break at earlier changesets. offthreadCompileFlag = asmNopFillFlag = asmPoolMaxOffsetFlag = gczealValueFlag = False # flags is a list of flags, and the option must exactly match. for entry in flags: # What comes after these flags needs to be a number, so we look for the string instead. if '--ion-offthread-compile=' in entry: offthreadCompileFlag = True elif '--arm-asm-nop-fill=' in entry: asmNopFillFlag = True elif '--asm-pool-max-offset=' in entry: asmPoolMaxOffsetFlag = True elif '--gc-zeal=' in entry: gczealValueFlag = True required = [] if options.enableSimulatorArm64: # This should get updated whenever ARM64 builds are stable, probably ~end-June 2015 required.append( '25e99bc12482' ) # m-c 249239 Fx41, 1st w/--enable-simulator=[arm|arm64|mips], see bug 1173992 if "--ion-regalloc=testbed" in flags: required.append( '47e92bae09fd' ) # m-c 248962 Fx41, 1st w/--ion-regalloc=testbed, see bug 1170840 if '--non-writable-jitcode' in flags: required.append( 'b46d6692fe50' ) # m-c 248578 Fx41, 1st w/--non-writable-jitcode, see bug 977805 if '--ion-extra-checks' in flags: required.append( 'cdf93416b39a' ) # m-c 234228 Fx39, 1st w/--ion-extra-checks, see bug 1139152 if '--no-cgc' in flags: required.append( 'b63d7e80709a' ) # m-c 227705 Fx38, 1st w/--no-cgc, see bug 1126769 and see bug 1129233 if '--unboxed-objects' in flags: required.append( '7820fd141998' ) # m-c 225967 Fx38, 1st w/--unboxed-objects, see bug 1116855 if '--ion-sink=on' in flags: required.append( '9188c8b7962b' ) # m-c 217242 Fx36, 1st w/--ion-sink=on, see bug 1093674 if gczealValueFlag: required.append( '03c6a758c9e8' ) # m-c 216625 Fx36, 1st w/--gc-zeal=14, see bug 1101602 if '--no-incremental-gc' in flags: required.append( '35025fd9e99b' ) # m-c 211115 Fx36, 1st w/--no-incremental-gc, see bug 958492 if '--ion-loop-unrolling=on' in flags: required.append( 'aa33f4725177' ) # m-c 198804 Fx34, 1st w/--ion-loop-unrolling=on, see bug 1039458 if '--no-threads' in flags: required.append( 'e8558ecd9b16' ) # m-c 195999 Fx34, 1st w/--no-threads, see bug 1031529 if sps.isMozBuild64 or options.enableNsprBuild: # 64-bit builds have peculiar complexities prior to this required.append( 'a459b02a9ca4' ) # m-c 194734 Fx33, 1st w/--enable-nspr-build, see bug 975011 if asmPoolMaxOffsetFlag: required.append( 'f114c4101f02' ) # m-c 194525 Fx33, 1st w/--asm-pool-max-offset=1024, see bug 1026919 if asmNopFillFlag: required.append( 'f1bacafe789c' ) # m-c 192164 Fx33, 1st w/--arm-asm-nop-fill=0, see bug 1020834 if offthreadCompileFlag: required.append( 'f0d67b1ccff9' ) # m-c 188901 Fx33, 1st w/--ion-offthread-compile=off, see bug 1020364 if '--no-native-regexp' in flags: required.append( '43acd23f5a98' ) # m-c 183413 Fx32, 1st w/--no-native-regexp, see bug 976446 if options.enableSimulatorArm32: # --enable-arm-simulator became --enable-simulator=arm in rev 25e99bc12482 # but unknown flags are ignored, so we compile using both till Fx38 ESR is deprecated required.append('5ad5f92387a2') # m-c 179476 Fx31, see bug 1173992 if sps.isWin: required.append( 'abfaf0ccae19' ) # m-c 169626 Fx30, 1st w/reliably successful Win builds, see bug 974739 if sps.isMac: required.append( 'f9374ef0fbed' ) # m-c 163848 Fx29, prior builds have issues with Xcode 6.3 and above required.append( 'df3c2a1e86d3' ) # m-c 160479 Fx29, prior non-threadsafe builds act weirdly with threadsafe-only flags from later revs, see bug 927685 return "first((" + commonDescendants(required) + ") - (" + skipRevs + "))"
def earliestKnownWorkingRev(options, flags, skipRevs): """Return a revset which evaluates to the first revision of the shell that compiles with |options| and runs jsfunfuzz successfully with |flags|.""" assert (not sps.isMac) or (sps.macVer() >= [10, 10] ) # Only support at least Mac OS X 10.10 # These should be in descending order, or bisection will break at earlier changesets. gczealValueFlag = False # flags is a list of flags, and the option must exactly match. for entry in flags: # What comes after these flags needs to be a number, so we look for the string instead. if '--gc-zeal=' in entry: gczealValueFlag = True required = [] if "--ion-pgo=on" in flags: required.append( 'b0a0ff5fa705' ) # m-c 272274 Fx45, 1st w/--ion-pgo=on, see bug 1209515 if options.buildWithAsan: required.append( 'd4e0e0e5d26d' ) # m-c 268534 Fx44, 1st w/ reliable ASan builds w/ ICU, see bug 1214464 if "--ion-sincos=on" in flags: required.append( '3dec2b935295' ) # m-c 262544 Fx43, 1st w/--ion-sincos=on, see bug 984018 if "--ion-instruction-reordering=on" in flags: required.append( '59d2f2e62420' ) # m-c 259672 Fx43, 1st w/--ion-instruction-reordering=on, see bug 1195545 if "--ion-shared-stubs=on" in flags: required.append( '3655d19ce241' ) # m-c 257573 Fx43, 1st w/--ion-shared-stubs=on, see bug 1168756 if options.enableSimulatorArm32 or options.enableSimulatorArm64: # For ARM64: This should get updated whenever ARM64 builds are stable, probably ~end-June 2015 # To bisect manually slightly further, use "-s dc4b163f7db7 -e f50a771d7d1b" and: # Also comment out from https://github.com/MozillaSecurity/funfuzz/blob/bbc5d5c74dc96823ed3932eed1ab18c299bd806c/autobisect-js/autoBisect.py#L176 # (line 176) to line 180. required.append( '25e99bc12482' ) # m-c 249239 Fx41, 1st w/--enable-simulator=[arm|arm64|mips], see bug 1173992 if "--ion-regalloc=testbed" in flags: required.append( '47e92bae09fd' ) # m-c 248962 Fx41, 1st w/--ion-regalloc=testbed, see bug 1170840 if '--non-writable-jitcode' in flags: required.append( 'b46d6692fe50' ) # m-c 248578 Fx41, 1st w/--non-writable-jitcode, see bug 977805 if '--no-unboxed-objects' in flags: required.append( '322487136b28' ) # m-c 244297 Fx41, 1st w/--no-unboxed-objects, see bug 1162199 if '--unboxed-arrays' in flags: required.append( '020c6a559e3a' ) # m-c 242167 Fx40, 1st w/--unboxed-arrays, see bug 1146597 if '--ion-extra-checks' in flags: required.append( 'cdf93416b39a' ) # m-c 234228 Fx39, 1st w/--ion-extra-checks, see bug 1139152 if '--no-cgc' in flags: required.append( 'b63d7e80709a' ) # m-c 227705 Fx38, 1st w/--no-cgc, see bug 1126769 and see bug 1129233 if sps.isWin: required.append( '8937836d3c93' ) # m-c 226774 Fx38, 1st w/ successful MSVC 2015 builds, see bug 1119072 if sps.isLinux and float(platform.linux_distribution()[1]) > 15.04: required.append( 'bcacb5692ad9' ) # m-c 222786 Fx37, 1st w/ successful GCC 5.2.x builds on Ubuntu 15.10 onwards if sps.isLinux: required.append( '6ec9033a4535' ) # m-c 217796 Fx36, previous builds fail on some Linux variants with different compiler versions if '--ion-sink=on' in flags: required.append( '9188c8b7962b' ) # m-c 217242 Fx36, 1st w/--ion-sink=on, see bug 1093674 if gczealValueFlag: required.append( '03c6a758c9e8' ) # m-c 216625 Fx36, 1st w/--gc-zeal=14, see bug 1101602 required.append( 'dc4b163f7db7' ) # m-c 213475 Fx36, prior builds have issues with Xcode 7.0 and above return "first((" + commonDescendants(required) + ") - (" + skipRevs + "))"
def cfgBin(shell): '''This function configures a binary according to required parameters.''' cfgCmdList = [] cfgEnvDt = copy.deepcopy(os.environ) origCfgEnvDt = copy.deepcopy(os.environ) cfgEnvDt['AR'] = 'ar' if sps.isARMv7l: # 32-bit shell on ARM boards, e.g. odroid boards. # This is tested on Ubuntu 14.04 with necessary armel libraries (force)-installed. assert shell.buildOptions.enable32, 'arm7vl boards are only 32-bit, armv8 boards will be 64-bit.' if not shell.buildOptions.enableHardFp: cfgEnvDt[ 'CC'] = 'gcc-4.7 -mfloat-abi=softfp -B/usr/lib/gcc/arm-linux-gnueabi/4.7' cfgEnvDt[ 'CXX'] = 'g++-4.7 -mfloat-abi=softfp -B/usr/lib/gcc/arm-linux-gnueabi/4.7' cfgCmdList.append('sh') cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) # From mjrosenb: things might go wrong if these three lines are not present for # compiling ARM on a 64-bit host machine. Not needed if compiling on the board itself. # cfgCmdList.append('--target=arm-linux-gnueabi') # cfgCmdList.append('--with-arch=armv7-a') # cfgCmdList.append('--with-thumb') if not shell.buildOptions.enableHardFp: cfgCmdList.append('--target=arm-linux-gnueabi') elif shell.buildOptions.enable32 and os.name == 'posix': # 32-bit shell on Mac OS X 10.10 Yosemite and greater if sps.isMac: assert sps.macVer() >= [ 10, 10 ] # We no longer support 10.9 Mavericks and prior. # Uses system clang cfgEnvDt['CC'] = cfgEnvDt[ 'HOST_CC'] = 'clang' + CLANG_PARAMS + SSE2_FLAGS cfgEnvDt['CXX'] = cfgEnvDt[ 'HOST_CXX'] = 'clang++' + CLANG_PARAMS + SSE2_FLAGS if shell.buildOptions.buildWithAsan: cfgEnvDt['CC'] += CLANG_ASAN_PARAMS cfgEnvDt['CXX'] += CLANG_ASAN_PARAMS cfgEnvDt['CC'] = cfgEnvDt[ 'CC'] + CLANG_X86_FLAG # only needed for CC, not HOST_CC cfgEnvDt['CXX'] = cfgEnvDt[ 'CXX'] + CLANG_X86_FLAG # only needed for CXX, not HOST_CXX cfgEnvDt['RANLIB'] = 'ranlib' cfgEnvDt['AS'] = '$CC' cfgEnvDt['LD'] = 'ld' cfgEnvDt['STRIP'] = 'strip -x -S' cfgEnvDt['CROSS_COMPILE'] = '1' if sps.isProgramInstalled('brew'): cfgEnvDt[ 'AUTOCONF'] = '/usr/local/Cellar/autoconf213/2.13/bin/autoconf213' cfgCmdList.append('sh') cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) cfgCmdList.append( '--target=i386-apple-darwin14.5.0') # Yosemite 10.10.5 if shell.buildOptions.buildWithAsan: cfgCmdList.append('--enable-address-sanitizer') if shell.buildOptions.enableSimulatorArm32: # --enable-arm-simulator became --enable-simulator=arm in rev 25e99bc12482 # but unknown flags are ignored, so we compile using both till Fx38 ESR is deprecated # Newer configure.in changes mean that things blow up if unknown/removed configure # options are entered, so specify it only if it's requested. if shell.buildOptions.enableArmSimulatorObsolete: cfgCmdList.append('--enable-arm-simulator') cfgCmdList.append('--enable-simulator=arm') # 32-bit shell on 32/64-bit x86 Linux elif sps.isLinux and not sps.isARMv7l: cfgEnvDt['PKG_CONFIG_LIBDIR'] = '/usr/lib/pkgconfig' if shell.buildOptions.buildWithClang: cfgEnvDt['CC'] = cfgEnvDt[ 'HOST_CC'] = 'clang' + CLANG_PARAMS + SSE2_FLAGS + CLANG_X86_FLAG cfgEnvDt['CXX'] = cfgEnvDt[ 'HOST_CXX'] = 'clang++' + CLANG_PARAMS + SSE2_FLAGS + CLANG_X86_FLAG else: # apt-get `lib32z1 gcc-multilib g++-multilib` first, if on 64-bit Linux. cfgEnvDt['CC'] = 'gcc -m32' + SSE2_FLAGS cfgEnvDt['CXX'] = 'g++ -m32' + SSE2_FLAGS if shell.buildOptions.buildWithAsan: cfgEnvDt['CC'] += CLANG_ASAN_PARAMS cfgEnvDt['CXX'] += CLANG_ASAN_PARAMS cfgCmdList.append('sh') cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) cfgCmdList.append('--target=i686-pc-linux') if shell.buildOptions.buildWithAsan: cfgCmdList.append('--enable-address-sanitizer') if shell.buildOptions.enableSimulatorArm32: # --enable-arm-simulator became --enable-simulator=arm in rev 25e99bc12482 # but unknown flags are ignored, so we compile using both till Fx38 ESR is deprecated # Newer configure.in changes mean that things blow up if unknown/removed configure # options are entered, so specify it only if it's requested. if shell.buildOptions.enableArmSimulatorObsolete: cfgCmdList.append('--enable-arm-simulator') cfgCmdList.append('--enable-simulator=arm') else: cfgCmdList.append('sh') cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) # 64-bit shell on Mac OS X 10.10 Yosemite and greater elif sps.isMac and sps.macVer() >= [10, 10 ] and not shell.buildOptions.enable32: cfgEnvDt['CC'] = 'clang' + CLANG_PARAMS cfgEnvDt['CXX'] = 'clang++' + CLANG_PARAMS if shell.buildOptions.buildWithAsan: cfgEnvDt['CC'] += CLANG_ASAN_PARAMS cfgEnvDt['CXX'] += CLANG_ASAN_PARAMS if sps.isProgramInstalled('brew'): cfgEnvDt[ 'AUTOCONF'] = '/usr/local/Cellar/autoconf213/2.13/bin/autoconf213' cfgCmdList.append('sh') cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) cfgCmdList.append( '--target=x86_64-apple-darwin14.5.0') # Yosemite 10.10.5 if shell.buildOptions.buildWithAsan: cfgCmdList.append('--enable-address-sanitizer') if shell.buildOptions.enableSimulatorArm64: cfgCmdList.append('--enable-simulator=arm64') elif sps.isWin: cfgEnvDt['MAKE'] = 'mozmake' # Workaround for bug 948534 if shell.buildOptions.buildWithClang: cfgEnvDt['CC'] = 'clang-cl.exe' + CLANG_PARAMS cfgEnvDt['CXX'] = 'clang-cl.exe' + CLANG_PARAMS # Note: Doesn't seem to work yet. # if shell.buildOptions.buildWithAsan: # cfgEnvDt['CC'] += CLANG_ASAN_PARAMS # cfgEnvDt['CXX'] += CLANG_ASAN_PARAMS cfgCmdList.append('sh') cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) if shell.buildOptions.enable32: if shell.buildOptions.enableSimulatorArm32: # --enable-arm-simulator became --enable-simulator=arm in rev 25e99bc12482 # but unknown flags are ignored, so we compile using both till Fx38 ESR is deprecated # Newer configure.in changes mean that things blow up if unknown/removed configure # options are entered, so specify it only if it's requested. if shell.buildOptions.enableArmSimulatorObsolete: cfgCmdList.append('--enable-arm-simulator') cfgCmdList.append('--enable-simulator=arm') else: cfgCmdList.append('--host=x86_64-pc-mingw32') cfgCmdList.append('--target=x86_64-pc-mingw32') if shell.buildOptions.enableSimulatorArm64: cfgCmdList.append('--enable-simulator=arm64') # Note: Doesn't seem to work yet. # if shell.buildOptions.buildWithAsan: # cfgCmdList.append('--enable-address-sanitizer') else: # We might still be using GCC on Linux 64-bit, so do not use clang unless Asan is specified if shell.buildOptions.buildWithClang: cfgEnvDt['CC'] = 'clang' + CLANG_PARAMS cfgEnvDt['CXX'] = 'clang++' + CLANG_PARAMS if shell.buildOptions.buildWithAsan: cfgEnvDt['CC'] += CLANG_ASAN_PARAMS cfgEnvDt['CXX'] += CLANG_ASAN_PARAMS cfgCmdList.append('sh') cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) if shell.buildOptions.buildWithAsan: cfgCmdList.append('--enable-address-sanitizer') if shell.buildOptions.buildWithClang: if sps.isWin: assert 'clang-cl' in cfgEnvDt['CC'] assert 'clang-cl' in cfgEnvDt['CXX'] else: assert 'clang' in cfgEnvDt['CC'] assert 'clang++' in cfgEnvDt['CXX'] cfgCmdList.append('--disable-jemalloc') # See bug 1146895 if shell.buildOptions.enableDbg: cfgCmdList.append('--enable-debug') elif shell.buildOptions.disableDbg: cfgCmdList.append('--disable-debug') if shell.buildOptions.enableOpt: cfgCmdList.append('--enable-optimize' + ('=-O1' if shell.buildOptions.buildWithVg else '')) elif shell.buildOptions.disableOpt: cfgCmdList.append('--disable-optimize') if shell.buildOptions.enableProfiling: cfgCmdList.append('--enable-profiling') if shell.buildOptions.enableMoreDeterministic: # Fuzzing tweaks for more useful output, implemented in bug 706433 cfgCmdList.append('--enable-more-deterministic') if shell.buildOptions.enableOomBreakpoint: # Extra debugging help for OOM assertions cfgCmdList.append('--enable-oom-breakpoint') if shell.buildOptions.enableWithoutIntlApi: # Speeds up compilation but is non-default cfgCmdList.append('--without-intl-api') if shell.buildOptions.buildWithVg: cfgCmdList.append('--enable-valgrind') cfgCmdList.append('--disable-jemalloc') # We add the following flags by default. if os.name == 'posix': cfgCmdList.append('--with-ccache') cfgCmdList.append('--enable-gczeal') cfgCmdList.append( '--enable-debug-symbols') # gets debug symbols on opt shells cfgCmdList.append('--disable-tests') if os.name == 'nt': # FIXME: Replace this with sps.shellify. counter = 0 for entry in cfgCmdList: if os.sep in entry: assert sps.isWin # MozillaBuild on Windows sometimes confuses "/" and "\". cfgCmdList[counter] = cfgCmdList[counter].replace(os.sep, '//') counter = counter + 1 # Print whatever we added to the environment envVarList = [] for envVar in set(cfgEnvDt.keys()) - set(origCfgEnvDt.keys()): strToBeAppended = envVar + '="' + cfgEnvDt[envVar] + '"' \ if ' ' in cfgEnvDt[envVar] else envVar + '=' + cfgEnvDt[envVar] envVarList.append(strToBeAppended) sps.vdump('Command to be run is: ' + sps.shellify(envVarList) + ' ' + sps.shellify(cfgCmdList)) wDir = shell.getJsObjdir() assert os.path.isdir(wDir) if sps.isWin: changedCfgCmdList = [] for entry in cfgCmdList: # For JS, quoted from :glandium: "the way icu subconfigure is called is what changed. # but really, the whole thing likes forward slashes way better" # See bug 1038590 comment 9. if '\\' in entry: entry = entry.replace('\\', '/') changedCfgCmdList.append(entry) sps.captureStdout(changedCfgCmdList, ignoreStderr=True, currWorkingDir=wDir, env=cfgEnvDt) else: sps.captureStdout(cfgCmdList, ignoreStderr=True, currWorkingDir=wDir, env=cfgEnvDt) shell.setEnvAdded(envVarList) shell.setEnvFull(cfgEnvDt) shell.setCfgCmdExclEnv(cfgCmdList)
def earliestKnownWorkingRev(options, flags, skipRevs): ''' Returns a revset which evaluates to the first revision of the shell that compiles with |options| and runs jsfunfuzz successfully with |flags|. ''' assert (not sps.isMac) or ( sps.macVer() >= [10, 7] ) # Only Lion and above are supported with Clang 4. # These should be in descending order, or bisection will break at earlier changesets. offthreadCompileFlag = gczealValueFlag = False # flags is a list of flags, and the option must exactly match. for entry in flags: # What comes after these flags needs to be a number, so we look for the string instead. if '--ion-offthread-compile=' in entry: offthreadCompileFlag = True elif '--gc-zeal=' in entry: gczealValueFlag = True required = [] if "--ion-shared-stubs=on" in flags: required.append( '3655d19ce241' ) # m-c 257573 Fx43, 1st w/--ion-shared-stubs=on, see bug 1168756 if options.enableSimulatorArm64: # This should get updated whenever ARM64 builds are stable, probably ~end-June 2015 required.append( '25e99bc12482' ) # m-c 249239 Fx41, 1st w/--enable-simulator=[arm|arm64|mips], see bug 1173992 if "--ion-regalloc=testbed" in flags: required.append( '47e92bae09fd' ) # m-c 248962 Fx41, 1st w/--ion-regalloc=testbed, see bug 1170840 if '--non-writable-jitcode' in flags: required.append( 'b46d6692fe50' ) # m-c 248578 Fx41, 1st w/--non-writable-jitcode, see bug 977805 if '--no-unboxed-objects' in flags: required.append( '322487136b28' ) # m-c 244297 Fx41, 1st w/--no-unboxed-objects, see bug 1162199 if '--unboxed-arrays' in flags: required.append( '020c6a559e3a' ) # m-c 242167 Fx40, 1st w/--unboxed-arrays, see bug 1146597 if '--ion-extra-checks' in flags: required.append( 'cdf93416b39a' ) # m-c 234228 Fx39, 1st w/--ion-extra-checks, see bug 1139152 if '--no-cgc' in flags: required.append( 'b63d7e80709a' ) # m-c 227705 Fx38, 1st w/--no-cgc, see bug 1126769 and see bug 1129233 if sps.isWin: required.append( '8937836d3c93' ) # m-c 226774 Fx38, 1st w/ successful MSVC 2013 and 2015 builds, see bug 1119072 if sps.isLinux: required.append( '6ec9033a4535' ) # m-c 217796 Fx36, previous builds fail on some Linux variants with different compiler versions if '--ion-sink=on' in flags: required.append( '9188c8b7962b' ) # m-c 217242 Fx36, 1st w/--ion-sink=on, see bug 1093674 if gczealValueFlag: required.append( '03c6a758c9e8' ) # m-c 216625 Fx36, 1st w/--gc-zeal=14, see bug 1101602 if '--no-incremental-gc' in flags: required.append( '35025fd9e99b' ) # m-c 211115 Fx36, 1st w/--no-incremental-gc, see bug 958492 if '--ion-loop-unrolling=on' in flags: required.append( 'aa33f4725177' ) # m-c 198804 Fx34, 1st w/--ion-loop-unrolling=on, see bug 1039458 if '--no-threads' in flags: required.append( 'e8558ecd9b16' ) # m-c 195999 Fx34, 1st w/--no-threads, see bug 1031529 if options.enableNsprBuild: required.append( 'a459b02a9ca4' ) # m-c 194734 Fx33, 1st w/--enable-nspr-build, see bug 975011 if offthreadCompileFlag: required.append( 'f0d67b1ccff9' ) # m-c 188901 Fx33, 1st w/--ion-offthread-compile=off, see bug 1020364 if '--no-native-regexp' in flags: required.append( '43acd23f5a98' ) # m-c 183413 Fx32, 1st w/--no-native-regexp, see bug 976446 if options.enableSimulatorArm32: # --enable-arm-simulator became --enable-simulator=arm in rev 25e99bc12482 # but unknown flags are ignored, so we compile using both till Fx38 ESR is deprecated required.append('5ad5f92387a2') # m-c 179476 Fx31, see bug 1173992 required.append( 'f9374ef0fbed' ) # m-c 163848 Fx29, prior builds have issues with Xcode 6.3 and above return "first((" + commonDescendants(required) + ") - (" + skipRevs + "))"
def cfgBin(shell): """Configure a binary according to required parameters.""" cfgCmdList = [] cfgEnvDt = copy.deepcopy(os.environ) origCfgEnvDt = copy.deepcopy(os.environ) cfgEnvDt['AR'] = 'ar' if sps.isARMv7l: # 32-bit shell on ARM boards, e.g. odroid boards. # This is tested on Ubuntu 14.04 with necessary armel libraries (force)-installed. assert shell.buildOptions.enable32, 'arm7vl boards are only 32-bit, armv8 boards will be 64-bit.' if not shell.buildOptions.enableHardFp: cfgEnvDt['CC'] = 'gcc-4.7 -mfloat-abi=softfp -B/usr/lib/gcc/arm-linux-gnueabi/4.7' cfgEnvDt['CXX'] = 'g++-4.7 -mfloat-abi=softfp -B/usr/lib/gcc/arm-linux-gnueabi/4.7' cfgCmdList.append('sh') cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) # From mjrosenb: things might go wrong if these three lines are not present for # compiling ARM on a 64-bit host machine. Not needed if compiling on the board itself. # cfgCmdList.append('--target=arm-linux-gnueabi') # cfgCmdList.append('--with-arch=armv7-a') # cfgCmdList.append('--with-thumb') if not shell.buildOptions.enableHardFp: cfgCmdList.append('--target=arm-linux-gnueabi') elif shell.buildOptions.enable32 and os.name == 'posix': # 32-bit shell on Mac OS X 10.10 Yosemite and greater if sps.isMac: assert sps.macVer() >= [10, 10] # We no longer support 10.9 Mavericks and prior. # Uses system clang cfgEnvDt['CC'] = cfgEnvDt['HOST_CC'] = 'clang' + CLANG_PARAMS + SSE2_FLAGS cfgEnvDt['CXX'] = cfgEnvDt['HOST_CXX'] = 'clang++' + CLANG_PARAMS + SSE2_FLAGS if shell.buildOptions.buildWithAsan: cfgEnvDt['CC'] += CLANG_ASAN_PARAMS cfgEnvDt['CXX'] += CLANG_ASAN_PARAMS cfgEnvDt['CC'] = cfgEnvDt['CC'] + CLANG_X86_FLAG # only needed for CC, not HOST_CC cfgEnvDt['CXX'] = cfgEnvDt['CXX'] + CLANG_X86_FLAG # only needed for CXX, not HOST_CXX cfgEnvDt['RANLIB'] = 'ranlib' cfgEnvDt['AS'] = '$CC' cfgEnvDt['LD'] = 'ld' cfgEnvDt['STRIP'] = 'strip -x -S' cfgEnvDt['CROSS_COMPILE'] = '1' if sps.isProgramInstalled('brew'): cfgEnvDt['AUTOCONF'] = '/usr/local/Cellar/autoconf213/2.13/bin/autoconf213' cfgCmdList.append('sh') cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) cfgCmdList.append('--target=i386-apple-darwin14.5.0') # Yosemite 10.10.5 if shell.buildOptions.buildWithAsan: cfgCmdList.append('--enable-address-sanitizer') if shell.buildOptions.enableSimulatorArm32: # --enable-arm-simulator became --enable-simulator=arm in rev 25e99bc12482 # but unknown flags are ignored, so we compile using both till Fx38 ESR is deprecated # Newer configure.in changes mean that things blow up if unknown/removed configure # options are entered, so specify it only if it's requested. if shell.buildOptions.enableArmSimulatorObsolete: cfgCmdList.append('--enable-arm-simulator') cfgCmdList.append('--enable-simulator=arm') # 32-bit shell on 32/64-bit x86 Linux elif sps.isLinux and not sps.isARMv7l: cfgEnvDt['PKG_CONFIG_LIBDIR'] = '/usr/lib/pkgconfig' if shell.buildOptions.buildWithClang: cfgEnvDt['CC'] = cfgEnvDt['HOST_CC'] = 'clang' + CLANG_PARAMS + SSE2_FLAGS + CLANG_X86_FLAG cfgEnvDt['CXX'] = cfgEnvDt['HOST_CXX'] = 'clang++' + CLANG_PARAMS + SSE2_FLAGS + CLANG_X86_FLAG else: # apt-get `lib32z1 gcc-multilib g++-multilib` first, if on 64-bit Linux. cfgEnvDt['CC'] = 'gcc -m32' + SSE2_FLAGS cfgEnvDt['CXX'] = 'g++ -m32' + SSE2_FLAGS if shell.buildOptions.buildWithAsan: cfgEnvDt['CC'] += CLANG_ASAN_PARAMS cfgEnvDt['CXX'] += CLANG_ASAN_PARAMS cfgCmdList.append('sh') cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) cfgCmdList.append('--target=i686-pc-linux') if shell.buildOptions.buildWithAsan: cfgCmdList.append('--enable-address-sanitizer') if shell.buildOptions.enableSimulatorArm32: # --enable-arm-simulator became --enable-simulator=arm in rev 25e99bc12482 # but unknown flags are ignored, so we compile using both till Fx38 ESR is deprecated # Newer configure.in changes mean that things blow up if unknown/removed configure # options are entered, so specify it only if it's requested. if shell.buildOptions.enableArmSimulatorObsolete: cfgCmdList.append('--enable-arm-simulator') cfgCmdList.append('--enable-simulator=arm') else: cfgCmdList.append('sh') cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) # 64-bit shell on Mac OS X 10.10 Yosemite and greater elif sps.isMac and sps.macVer() >= [10, 10] and not shell.buildOptions.enable32: cfgEnvDt['CC'] = 'clang' + CLANG_PARAMS cfgEnvDt['CXX'] = 'clang++' + CLANG_PARAMS if shell.buildOptions.buildWithAsan: cfgEnvDt['CC'] += CLANG_ASAN_PARAMS cfgEnvDt['CXX'] += CLANG_ASAN_PARAMS if sps.isProgramInstalled('brew'): cfgEnvDt['AUTOCONF'] = '/usr/local/Cellar/autoconf213/2.13/bin/autoconf213' cfgCmdList.append('sh') cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) cfgCmdList.append('--target=x86_64-apple-darwin14.5.0') # Yosemite 10.10.5 if shell.buildOptions.buildWithAsan: cfgCmdList.append('--enable-address-sanitizer') if shell.buildOptions.enableSimulatorArm64: cfgCmdList.append('--enable-simulator=arm64') elif sps.isWin: cfgEnvDt['MAKE'] = 'mozmake' # Workaround for bug 948534 if shell.buildOptions.buildWithClang: cfgEnvDt['CC'] = 'clang-cl.exe' + CLANG_PARAMS cfgEnvDt['CXX'] = 'clang-cl.exe' + CLANG_PARAMS # Note: Doesn't seem to work yet. # if shell.buildOptions.buildWithAsan: # cfgEnvDt['CC'] += CLANG_ASAN_PARAMS # cfgEnvDt['CXX'] += CLANG_ASAN_PARAMS cfgCmdList.append('sh') cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) if shell.buildOptions.enable32: if shell.buildOptions.enableSimulatorArm32: # --enable-arm-simulator became --enable-simulator=arm in rev 25e99bc12482 # but unknown flags are ignored, so we compile using both till Fx38 ESR is deprecated # Newer configure.in changes mean that things blow up if unknown/removed configure # options are entered, so specify it only if it's requested. if shell.buildOptions.enableArmSimulatorObsolete: cfgCmdList.append('--enable-arm-simulator') cfgCmdList.append('--enable-simulator=arm') else: cfgCmdList.append('--host=x86_64-pc-mingw32') cfgCmdList.append('--target=x86_64-pc-mingw32') if shell.buildOptions.enableSimulatorArm64: cfgCmdList.append('--enable-simulator=arm64') # Note: Doesn't seem to work yet. # if shell.buildOptions.buildWithAsan: # cfgCmdList.append('--enable-address-sanitizer') else: # We might still be using GCC on Linux 64-bit, so do not use clang unless Asan is specified if shell.buildOptions.buildWithClang: cfgEnvDt['CC'] = 'clang' + CLANG_PARAMS cfgEnvDt['CXX'] = 'clang++' + CLANG_PARAMS if shell.buildOptions.buildWithAsan: cfgEnvDt['CC'] += CLANG_ASAN_PARAMS cfgEnvDt['CXX'] += CLANG_ASAN_PARAMS cfgCmdList.append('sh') cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) if shell.buildOptions.buildWithAsan: cfgCmdList.append('--enable-address-sanitizer') if shell.buildOptions.buildWithClang: if sps.isWin: assert 'clang-cl' in cfgEnvDt['CC'] assert 'clang-cl' in cfgEnvDt['CXX'] else: assert 'clang' in cfgEnvDt['CC'] assert 'clang++' in cfgEnvDt['CXX'] cfgCmdList.append('--disable-jemalloc') # See bug 1146895 if shell.buildOptions.enableDbg: cfgCmdList.append('--enable-debug') elif shell.buildOptions.disableDbg: cfgCmdList.append('--disable-debug') if shell.buildOptions.enableOpt: cfgCmdList.append('--enable-optimize' + ('=-O1' if shell.buildOptions.buildWithVg else '')) elif shell.buildOptions.disableOpt: cfgCmdList.append('--disable-optimize') if shell.buildOptions.enableProfiling: cfgCmdList.append('--enable-profiling') if shell.buildOptions.enableMoreDeterministic: # Fuzzing tweaks for more useful output, implemented in bug 706433 cfgCmdList.append('--enable-more-deterministic') if shell.buildOptions.enableOomBreakpoint: # Extra debugging help for OOM assertions cfgCmdList.append('--enable-oom-breakpoint') if shell.buildOptions.enableWithoutIntlApi: # Speeds up compilation but is non-default cfgCmdList.append('--without-intl-api') if shell.buildOptions.buildWithVg: cfgCmdList.append('--enable-valgrind') cfgCmdList.append('--disable-jemalloc') # We add the following flags by default. if os.name == 'posix': cfgCmdList.append('--with-ccache') cfgCmdList.append('--enable-gczeal') cfgCmdList.append('--enable-debug-symbols') # gets debug symbols on opt shells cfgCmdList.append('--disable-tests') if os.name == 'nt': # FIXME: Replace this with sps.shellify. counter = 0 for entry in cfgCmdList: if os.sep in entry: assert sps.isWin # MozillaBuild on Windows sometimes confuses "/" and "\". cfgCmdList[counter] = cfgCmdList[counter].replace(os.sep, '//') counter = counter + 1 # Print whatever we added to the environment envVarList = [] for envVar in set(cfgEnvDt.keys()) - set(origCfgEnvDt.keys()): strToBeAppended = envVar + '="' + cfgEnvDt[envVar] + '"' \ if ' ' in cfgEnvDt[envVar] else envVar + '=' + cfgEnvDt[envVar] envVarList.append(strToBeAppended) sps.vdump('Command to be run is: ' + sps.shellify(envVarList) + ' ' + sps.shellify(cfgCmdList)) wDir = shell.getJsObjdir() assert os.path.isdir(wDir) if sps.isWin: changedCfgCmdList = [] for entry in cfgCmdList: # For JS, quoted from :glandium: "the way icu subconfigure is called is what changed. # but really, the whole thing likes forward slashes way better" # See bug 1038590 comment 9. if '\\' in entry: entry = entry.replace('\\', '/') changedCfgCmdList.append(entry) sps.captureStdout(changedCfgCmdList, ignoreStderr=True, currWorkingDir=wDir, env=cfgEnvDt) else: sps.captureStdout(cfgCmdList, ignoreStderr=True, currWorkingDir=wDir, env=cfgEnvDt) shell.setEnvAdded(envVarList) shell.setEnvFull(cfgEnvDt) shell.setCfgCmdExclEnv(cfgCmdList)
def cfgBin(shell, binToBeCompiled): '''This function configures a binary according to required parameters.''' cfgCmdList = [] cfgEnvDt = copy.deepcopy(os.environ) origCfgEnvDt = copy.deepcopy(os.environ) cfgEnvDt['AR'] = 'ar' # Check for determinism to prevent LLVM compilation from happening on releng machines, # since releng machines only test non-deterministic builds. if shell.buildOptions.buildWithAsan and shell.buildOptions.enableMoreDeterministic: llvmPath = envVars.findLlvmBinPath() assert llvmPath is not None CLANG_PATH = sps.normExpUserPath(os.path.join(llvmPath, 'clang')) CLANGPP_PATH = sps.normExpUserPath(os.path.join(llvmPath, 'clang++')) if sps.isARMv7l: # 32-bit shell on ARM boards, e.g. odroid boards. # This is tested on Ubuntu 14.04 with necessary armel libraries (force)-installed. assert shell.buildOptions.enable32, 'arm7vl boards are only 32-bit, armv8 boards will be 64-bit.' if not shell.buildOptions.enableHardFp: cfgEnvDt[ 'CC'] = 'gcc-4.7 -mfloat-abi=softfp -B/usr/lib/gcc/arm-linux-gnueabi/4.7' cfgEnvDt[ 'CXX'] = 'g++-4.7 -mfloat-abi=softfp -B/usr/lib/gcc/arm-linux-gnueabi/4.7' cfgCmdList.append('sh') if binToBeCompiled == 'nspr': cfgCmdList.append(os.path.normpath(shell.getNsprCfgPath())) else: cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) # From mjrosenb: things might go wrong if these three lines are not present for # compiling ARM on a 64-bit host machine. Not needed if compiling on the board itself. # cfgCmdList.append('--target=arm-linux-gnueabi') # cfgCmdList.append('--with-arch=armv7-a') # cfgCmdList.append('--with-thumb') if not shell.buildOptions.enableHardFp: cfgCmdList.append('--target=arm-linux-gnueabi') elif shell.buildOptions.enable32 and os.name == 'posix': # 32-bit shell on Mac OS X 10.7 Lion and greater if sps.isMac: assert sps.macVer() >= [ 10, 7 ] # We no longer support Snow Leopard 10.6 and prior. if shell.buildOptions.buildWithAsan: # Uses custom compiled clang cfgEnvDt['CC'] = cfgEnvDt['HOST_CC'] = CLANG_PATH + CLANG_PARAMS + \ CLANG_ASAN_PARAMS + SSE2_FLAGS cfgEnvDt['CXX'] = cfgEnvDt['HOST_CXX'] = CLANGPP_PATH + CLANG_PARAMS + \ CLANG_ASAN_PARAMS + SSE2_FLAGS else: # Uses system clang cfgEnvDt['CC'] = cfgEnvDt[ 'HOST_CC'] = 'clang' + CLANG_PARAMS + SSE2_FLAGS cfgEnvDt['CXX'] = cfgEnvDt[ 'HOST_CXX'] = 'clang++' + CLANG_PARAMS + SSE2_FLAGS cfgEnvDt['CC'] = cfgEnvDt[ 'CC'] + CLANG_X86_FLAG # only needed for CC, not HOST_CC cfgEnvDt['CXX'] = cfgEnvDt[ 'CXX'] + CLANG_X86_FLAG # only needed for CXX, not HOST_CXX cfgEnvDt['RANLIB'] = 'ranlib' cfgEnvDt['AS'] = '$CC' cfgEnvDt['LD'] = 'ld' cfgEnvDt['STRIP'] = 'strip -x -S' cfgEnvDt['CROSS_COMPILE'] = '1' if sps.isProgramInstalled('brew'): cfgEnvDt[ 'AUTOCONF'] = '/usr/local/Cellar/autoconf213/2.13/bin/autoconf213' cfgCmdList.append('sh') if binToBeCompiled == 'nspr': cfgCmdList.append(os.path.normpath(shell.getNsprCfgPath())) else: cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) cfgCmdList.append( '--target=i386-apple-darwin9.2.0') # Leopard 10.5.2 cfgCmdList.append('--enable-macos-target=10.5') if shell.buildOptions.buildWithAsan: cfgCmdList.append('--enable-address-sanitizer') if shell.buildOptions.enableSimulatorArm32: # --enable-arm-simulator became --enable-simulator=arm in rev 25e99bc12482 # but unknown flags are ignored, so we compile using both till Fx38 ESR is deprecated cfgCmdList.append('--enable-arm-simulator') cfgCmdList.append('--enable-simulator=arm') # 32-bit shell on 32/64-bit x86 Linux elif sps.isLinux and not sps.isARMv7l: cfgEnvDt['PKG_CONFIG_LIBDIR'] = '/usr/lib/pkgconfig' if shell.buildOptions.buildWithAsan: # Uses custom compiled clang cfgEnvDt['CC'] = cfgEnvDt['HOST_CC'] = CLANG_PATH + CLANG_PARAMS + \ CLANG_ASAN_PARAMS + SSE2_FLAGS + CLANG_X86_FLAG cfgEnvDt['CXX'] = cfgEnvDt['HOST_CXX'] = CLANGPP_PATH + CLANG_PARAMS + \ CLANG_ASAN_PARAMS + SSE2_FLAGS + CLANG_X86_FLAG else: # Uses system clang # We might still be using GCC on Linux 32-bit, use clang only if we specify ASan # apt-get `lib32z1 gcc-multilib g++-multilib` first, if on 64-bit Linux. cfgEnvDt['CC'] = 'gcc -m32' + SSE2_FLAGS cfgEnvDt['CXX'] = 'g++ -m32' + SSE2_FLAGS cfgCmdList.append('sh') if binToBeCompiled == 'nspr': cfgCmdList.append(os.path.normpath(shell.getNsprCfgPath())) else: cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) cfgCmdList.append('--target=i686-pc-linux') if shell.buildOptions.buildWithAsan: cfgCmdList.append('--enable-address-sanitizer') if shell.buildOptions.enableSimulatorArm32: # --enable-arm-simulator became --enable-simulator=arm in rev 25e99bc12482 # but unknown flags are ignored, so we compile using both till Fx38 ESR is deprecated cfgCmdList.append('--enable-arm-simulator') cfgCmdList.append('--enable-simulator=arm') else: cfgCmdList.append('sh') if binToBeCompiled == 'nspr': cfgCmdList.append(os.path.normpath(shell.getNsprCfgPath())) else: cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) # 64-bit shell on Mac OS X 10.7 Lion and greater elif sps.isMac and sps.macVer() >= [10, 7 ] and not shell.buildOptions.enable32: if shell.buildOptions.buildWithAsan: # Uses custom compiled clang cfgEnvDt['CC'] = CLANG_PATH + CLANG_PARAMS + CLANG_ASAN_PARAMS cfgEnvDt['CXX'] = CLANGPP_PATH + CLANG_PARAMS + CLANG_ASAN_PARAMS else: # Uses system clang cfgEnvDt['CC'] = 'clang' + CLANG_PARAMS cfgEnvDt['CXX'] = 'clang++' + CLANG_PARAMS if sps.isProgramInstalled('brew'): cfgEnvDt[ 'AUTOCONF'] = '/usr/local/Cellar/autoconf213/2.13/bin/autoconf213' cfgCmdList.append('sh') if binToBeCompiled == 'nspr': cfgCmdList.append(os.path.normpath(shell.getNsprCfgPath())) cfgCmdList.append('--enable-64bit') else: cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) cfgCmdList.append( '--target=x86_64-apple-darwin12.5.0') # Mountain Lion 10.8.5 if shell.buildOptions.buildWithAsan: cfgCmdList.append('--enable-address-sanitizer') if shell.buildOptions.enableSimulatorArm64: cfgCmdList.append('--enable-simulator=arm64') elif sps.isWin: cfgEnvDt['MAKE'] = 'mozmake' # Workaround for bug 948534 cfgCmdList.append('sh') if binToBeCompiled == 'nspr': cfgCmdList.append(os.path.normpath(shell.getNsprCfgPath())) if shell.buildOptions.enable32: cfgCmdList.append('--enable-win32-target=WIN95') else: cfgCmdList.append('--enable-64bit') else: cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) if shell.buildOptions.enable32: if shell.buildOptions.enableSimulatorArm32: # --enable-arm-simulator became --enable-simulator=arm in rev 25e99bc12482 # but unknown flags are ignored, so we compile using both till Fx38 ESR is deprecated cfgCmdList.append('--enable-arm-simulator') cfgCmdList.append('--enable-simulator=arm') else: cfgCmdList.append('--host=x86_64-pc-mingw32') cfgCmdList.append('--target=x86_64-pc-mingw32') if shell.buildOptions.enableSimulatorArm64: cfgCmdList.append('--enable-simulator=arm64') else: # We might still be using GCC on Linux 64-bit, so do not use clang unless Asan is specified if shell.buildOptions.buildWithAsan: # Uses custom compiled clang cfgEnvDt['CC'] = CLANG_PATH + CLANG_PARAMS + CLANG_ASAN_PARAMS cfgEnvDt['CXX'] = CLANGPP_PATH + CLANG_PARAMS + CLANG_ASAN_PARAMS cfgCmdList.append('sh') if binToBeCompiled == 'nspr': cfgCmdList.append(os.path.normpath(shell.getNsprCfgPath())) cfgCmdList.append('--enable-64bit') else: cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) if shell.buildOptions.buildWithAsan: cfgCmdList.append('--enable-address-sanitizer') if shell.buildOptions.buildWithAsan: assert 'clang' in cfgEnvDt['CC'] assert 'clang++' in cfgEnvDt['CXX'] cfgCmdList.append('--disable-jemalloc') # See bug 1146895 # For NSPR, specify "--disable-debug --enable-optimize" to generate an opt build. # They can actually be used independently, but it's not recommended. # https://developer.mozilla.org/en-US/docs/NSPR_build_instructions#Configure_options if shell.buildOptions.enableDbg: # NSPR configure without options compiles debug by default if binToBeCompiled == 'js': cfgCmdList.append('--enable-debug') elif shell.buildOptions.disableDbg or binToBeCompiled == 'nspr': cfgCmdList.append('--disable-debug') if shell.buildOptions.enableOpt: cfgCmdList.append('--enable-optimize' + ('=-O1' if shell.buildOptions.buildWithVg else '')) elif binToBeCompiled == 'js' and shell.buildOptions.disableOpt: # NSPR configure without options compiles debug by default cfgCmdList.append('--disable-optimize') if binToBeCompiled == 'nspr': cfgCmdList.append( '--prefix=' + sps.normExpUserPath(os.path.join(shell.getNsprObjdir(), 'dist'))) else: if shell.buildOptions.enableProfiling: cfgCmdList.append('--enable-profiling') if shell.getJsUsesNoThreadsFlag( ) and shell.buildOptions.enableNsprBuild: cfgCmdList.append('--enable-nspr-build') else: if shell.buildOptions.enableNsprBuild: cfgCmdList.append('--enable-threadsafe') if not shell.getJsBuildSystemConsidersNspr(): cfgCmdList.append( '--with-nspr-prefix=' + sps.normExpUserPath( os.path.join(shell.getNsprObjdir(), 'dist'))) cfgCmdList.append('--with-nspr-cflags=-I' + sps.normExpUserPath( os.path.join(shell.getNsprObjdir( ), 'dist', 'include', 'nspr'))) cfgCmdList.append('--with-nspr-libs=' + ' '.join([ sps.normExpUserPath( os.path.join(shell.getNsprObjdir(), 'dist', 'lib', compileLib)) for compileLib in inspectShell.ALL_COMPILE_LIBS ])) else: cfgCmdList.append('--disable-threadsafe') if shell.buildOptions.enableMoreDeterministic: # Fuzzing tweaks for more useful output, implemented in bug 706433 cfgCmdList.append('--enable-more-deterministic') if shell.buildOptions.buildWithVg: cfgCmdList.append('--enable-valgrind') cfgCmdList.append('--disable-jemalloc') # We add the following flags by default. if os.name == 'posix': cfgCmdList.append('--with-ccache') cfgCmdList.append('--enable-gczeal') cfgCmdList.append( '--enable-debug-symbols') # gets debug symbols on opt shells cfgCmdList.append('--disable-tests') if os.name == 'nt': # FIXME: Replace this with sps.shellify. counter = 0 for entry in cfgCmdList: if os.sep in entry: assert sps.isWin # MozillaBuild on Windows sometimes confuses "/" and "\". cfgCmdList[counter] = cfgCmdList[counter].replace(os.sep, '//') counter = counter + 1 # Print whatever we added to the environment envVarList = [] for envVar in set(cfgEnvDt.keys()) - set(origCfgEnvDt.keys()): strToBeAppended = envVar + '="' + cfgEnvDt[envVar] + '"' \ if ' ' in cfgEnvDt[envVar] else envVar + '=' + cfgEnvDt[envVar] envVarList.append(strToBeAppended) sps.vdump('Command to be run is: ' + sps.shellify(envVarList) + ' ' + sps.shellify(cfgCmdList)) wDir = shell.getNsprObjdir( ) if binToBeCompiled == 'nspr' else shell.getJsObjdir() assert os.path.isdir(wDir) if sps.isWin: changedCfgCmdList = [] for entry in cfgCmdList: # See bug 986715 comment 6 as to why we need forward slashes for NSPR # For JS, quoted from :glandium: "the way icu subconfigure is called is what changed. # but really, the whole thing likes forward slashes way better" # See bug 1038590 comment 9. if '\\' in entry: entry = entry.replace('\\', '/') changedCfgCmdList.append(entry) sps.captureStdout(changedCfgCmdList, ignoreStderr=True, currWorkingDir=wDir, env=cfgEnvDt) else: sps.captureStdout(cfgCmdList, ignoreStderr=True, currWorkingDir=wDir, env=cfgEnvDt) shell.setEnvAdded(envVarList) shell.setEnvFull(cfgEnvDt) shell.setCfgCmdExclEnv(cfgCmdList)
def cfgBin(shell): """This function configures a binary according to required parameters.""" cfgCmdList = [] cfgEnvDt = copy.deepcopy(os.environ) origCfgEnvDt = copy.deepcopy(os.environ) cfgEnvDt["AR"] = "ar" # Check for determinism to prevent LLVM compilation from happening on releng machines, # since releng machines only test non-deterministic builds. if shell.buildOptions.buildWithAsan and shell.buildOptions.enableMoreDeterministic: llvmPath = envVars.findLlvmBinPath() assert llvmPath is not None CLANG_PATH = sps.normExpUserPath(os.path.join(llvmPath, "clang")) CLANGPP_PATH = sps.normExpUserPath(os.path.join(llvmPath, "clang++")) if sps.isARMv7l: # 32-bit shell on ARM boards, e.g. odroid boards. # This is tested on Ubuntu 14.04 with necessary armel libraries (force)-installed. assert shell.buildOptions.enable32, "arm7vl boards are only 32-bit, armv8 boards will be 64-bit." if not shell.buildOptions.enableHardFp: cfgEnvDt["CC"] = "gcc-4.7 -mfloat-abi=softfp -B/usr/lib/gcc/arm-linux-gnueabi/4.7" cfgEnvDt["CXX"] = "g++-4.7 -mfloat-abi=softfp -B/usr/lib/gcc/arm-linux-gnueabi/4.7" cfgCmdList.append("sh") cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) # From mjrosenb: things might go wrong if these three lines are not present for # compiling ARM on a 64-bit host machine. Not needed if compiling on the board itself. # cfgCmdList.append('--target=arm-linux-gnueabi') # cfgCmdList.append('--with-arch=armv7-a') # cfgCmdList.append('--with-thumb') if not shell.buildOptions.enableHardFp: cfgCmdList.append("--target=arm-linux-gnueabi") elif shell.buildOptions.enable32 and os.name == "posix": # 32-bit shell on Mac OS X 10.7 Lion and greater if sps.isMac: assert sps.macVer() >= [10, 7] # We no longer support Snow Leopard 10.6 and prior. if shell.buildOptions.buildWithAsan: # Uses custom compiled clang cfgEnvDt["CC"] = cfgEnvDt["HOST_CC"] = CLANG_PATH + CLANG_PARAMS + CLANG_ASAN_PARAMS + SSE2_FLAGS cfgEnvDt["CXX"] = cfgEnvDt["HOST_CXX"] = CLANGPP_PATH + CLANG_PARAMS + CLANG_ASAN_PARAMS + SSE2_FLAGS else: # Uses system clang cfgEnvDt["CC"] = cfgEnvDt["HOST_CC"] = "clang" + CLANG_PARAMS + SSE2_FLAGS cfgEnvDt["CXX"] = cfgEnvDt["HOST_CXX"] = "clang++" + CLANG_PARAMS + SSE2_FLAGS cfgEnvDt["CC"] = cfgEnvDt["CC"] + CLANG_X86_FLAG # only needed for CC, not HOST_CC cfgEnvDt["CXX"] = cfgEnvDt["CXX"] + CLANG_X86_FLAG # only needed for CXX, not HOST_CXX cfgEnvDt["RANLIB"] = "ranlib" cfgEnvDt["AS"] = "$CC" cfgEnvDt["LD"] = "ld" cfgEnvDt["STRIP"] = "strip -x -S" cfgEnvDt["CROSS_COMPILE"] = "1" if sps.isProgramInstalled("brew"): cfgEnvDt["AUTOCONF"] = "/usr/local/Cellar/autoconf213/2.13/bin/autoconf213" cfgCmdList.append("sh") cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) cfgCmdList.append("--target=i386-apple-darwin9.2.0") # Leopard 10.5.2 cfgCmdList.append("--enable-macos-target=10.5") if shell.buildOptions.buildWithAsan: cfgCmdList.append("--enable-address-sanitizer") if shell.buildOptions.enableSimulatorArm32: # --enable-arm-simulator became --enable-simulator=arm in rev 25e99bc12482 # but unknown flags are ignored, so we compile using both till Fx38 ESR is deprecated cfgCmdList.append("--enable-arm-simulator") cfgCmdList.append("--enable-simulator=arm") # 32-bit shell on 32/64-bit x86 Linux elif sps.isLinux and not sps.isARMv7l: cfgEnvDt["PKG_CONFIG_LIBDIR"] = "/usr/lib/pkgconfig" if shell.buildOptions.buildWithAsan: # Uses custom compiled clang cfgEnvDt["CC"] = cfgEnvDt["HOST_CC"] = ( CLANG_PATH + CLANG_PARAMS + CLANG_ASAN_PARAMS + SSE2_FLAGS + CLANG_X86_FLAG ) cfgEnvDt["CXX"] = cfgEnvDt["HOST_CXX"] = ( CLANGPP_PATH + CLANG_PARAMS + CLANG_ASAN_PARAMS + SSE2_FLAGS + CLANG_X86_FLAG ) else: # Uses system clang # We might still be using GCC on Linux 32-bit, use clang only if we specify ASan # apt-get `lib32z1 gcc-multilib g++-multilib` first, if on 64-bit Linux. cfgEnvDt["CC"] = "gcc -m32" + SSE2_FLAGS cfgEnvDt["CXX"] = "g++ -m32" + SSE2_FLAGS cfgCmdList.append("sh") cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) cfgCmdList.append("--target=i686-pc-linux") if shell.buildOptions.buildWithAsan: cfgCmdList.append("--enable-address-sanitizer") if shell.buildOptions.enableSimulatorArm32: # --enable-arm-simulator became --enable-simulator=arm in rev 25e99bc12482 # but unknown flags are ignored, so we compile using both till Fx38 ESR is deprecated cfgCmdList.append("--enable-arm-simulator") cfgCmdList.append("--enable-simulator=arm") else: cfgCmdList.append("sh") cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) # 64-bit shell on Mac OS X 10.7 Lion and greater elif sps.isMac and sps.macVer() >= [10, 7] and not shell.buildOptions.enable32: if shell.buildOptions.buildWithAsan: # Uses custom compiled clang cfgEnvDt["CC"] = CLANG_PATH + CLANG_PARAMS + CLANG_ASAN_PARAMS cfgEnvDt["CXX"] = CLANGPP_PATH + CLANG_PARAMS + CLANG_ASAN_PARAMS else: # Uses system clang cfgEnvDt["CC"] = "clang" + CLANG_PARAMS cfgEnvDt["CXX"] = "clang++" + CLANG_PARAMS if sps.isProgramInstalled("brew"): cfgEnvDt["AUTOCONF"] = "/usr/local/Cellar/autoconf213/2.13/bin/autoconf213" cfgCmdList.append("sh") cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) cfgCmdList.append("--target=x86_64-apple-darwin12.5.0") # Mountain Lion 10.8.5 if shell.buildOptions.buildWithAsan: cfgCmdList.append("--enable-address-sanitizer") if shell.buildOptions.enableSimulatorArm64: cfgCmdList.append("--enable-simulator=arm64") elif sps.isWin: cfgEnvDt["MAKE"] = "mozmake" # Workaround for bug 948534 cfgCmdList.append("sh") cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) if shell.buildOptions.enable32: if shell.buildOptions.enableSimulatorArm32: # --enable-arm-simulator became --enable-simulator=arm in rev 25e99bc12482 # but unknown flags are ignored, so we compile using both till Fx38 ESR is deprecated cfgCmdList.append("--enable-arm-simulator") cfgCmdList.append("--enable-simulator=arm") else: cfgCmdList.append("--host=x86_64-pc-mingw32") cfgCmdList.append("--target=x86_64-pc-mingw32") if shell.buildOptions.enableSimulatorArm64: cfgCmdList.append("--enable-simulator=arm64") else: # We might still be using GCC on Linux 64-bit, so do not use clang unless Asan is specified if shell.buildOptions.buildWithAsan: # Uses custom compiled clang cfgEnvDt["CC"] = CLANG_PATH + CLANG_PARAMS + CLANG_ASAN_PARAMS cfgEnvDt["CXX"] = CLANGPP_PATH + CLANG_PARAMS + CLANG_ASAN_PARAMS cfgCmdList.append("sh") cfgCmdList.append(os.path.normpath(shell.getJsCfgPath())) if shell.buildOptions.buildWithAsan: cfgCmdList.append("--enable-address-sanitizer") if shell.buildOptions.buildWithAsan: assert "clang" in cfgEnvDt["CC"] assert "clang++" in cfgEnvDt["CXX"] cfgCmdList.append("--disable-jemalloc") # See bug 1146895 if shell.buildOptions.enableDbg: cfgCmdList.append("--enable-debug") elif shell.buildOptions.disableDbg: cfgCmdList.append("--disable-debug") if shell.buildOptions.enableOpt: cfgCmdList.append("--enable-optimize" + ("=-O1" if shell.buildOptions.buildWithVg else "")) elif shell.buildOptions.disableOpt: cfgCmdList.append("--disable-optimize") if shell.buildOptions.enableProfiling: cfgCmdList.append("--enable-profiling") if shell.buildOptions.enableMoreDeterministic: # Fuzzing tweaks for more useful output, implemented in bug 706433 cfgCmdList.append("--enable-more-deterministic") if shell.buildOptions.enableOomBreakpoint: # Extra debugging help for OOM assertions cfgCmdList.append("--enable-oom-breakpoint") if shell.buildOptions.enableWithoutIntlApi: # Speeds up compilation but is non-default cfgCmdList.append("--without-intl-api") if shell.buildOptions.buildWithVg: cfgCmdList.append("--enable-valgrind") cfgCmdList.append("--disable-jemalloc") # We add the following flags by default. if os.name == "posix": cfgCmdList.append("--with-ccache") cfgCmdList.append("--enable-gczeal") cfgCmdList.append("--enable-debug-symbols") # gets debug symbols on opt shells cfgCmdList.append("--disable-tests") if os.name == "nt": # FIXME: Replace this with sps.shellify. counter = 0 for entry in cfgCmdList: if os.sep in entry: assert sps.isWin # MozillaBuild on Windows sometimes confuses "/" and "\". cfgCmdList[counter] = cfgCmdList[counter].replace(os.sep, "//") counter = counter + 1 # Print whatever we added to the environment envVarList = [] for envVar in set(cfgEnvDt.keys()) - set(origCfgEnvDt.keys()): strToBeAppended = ( envVar + '="' + cfgEnvDt[envVar] + '"' if " " in cfgEnvDt[envVar] else envVar + "=" + cfgEnvDt[envVar] ) envVarList.append(strToBeAppended) sps.vdump("Command to be run is: " + sps.shellify(envVarList) + " " + sps.shellify(cfgCmdList)) wDir = shell.getJsObjdir() assert os.path.isdir(wDir) if sps.isWin: changedCfgCmdList = [] for entry in cfgCmdList: # For JS, quoted from :glandium: "the way icu subconfigure is called is what changed. # but really, the whole thing likes forward slashes way better" # See bug 1038590 comment 9. if "\\" in entry: entry = entry.replace("\\", "/") changedCfgCmdList.append(entry) sps.captureStdout(changedCfgCmdList, ignoreStderr=True, currWorkingDir=wDir, env=cfgEnvDt) else: sps.captureStdout(cfgCmdList, ignoreStderr=True, currWorkingDir=wDir, env=cfgEnvDt) shell.setEnvAdded(envVarList) shell.setEnvFull(cfgEnvDt) shell.setCfgCmdExclEnv(cfgCmdList)
def earliestKnownWorkingRev(options, flags, skipRevs): ''' Returns a revset which evaluates to the first revision of the shell that compiles with |options| and runs jsfunfuzz successfully with |flags|. ''' assert (not sps.isMac) or (sps.macVer() >= [10, 7]) # Only Lion and above are supported with Clang 4. # These should be in descending order, or bisection will break at earlier changesets. offthreadCompileFlag = asmNopFillFlag = asmPoolMaxOffsetFlag = gczealValueFlag = False # flags is a list of flags, and the option must exactly match. for entry in flags: # What comes after these flags needs to be a number, so we look for the string instead. if '--ion-offthread-compile=' in entry: offthreadCompileFlag = True elif '--arm-asm-nop-fill=' in entry: asmNopFillFlag = True elif '--asm-pool-max-offset=' in entry: asmPoolMaxOffsetFlag = True elif '--gc-zeal=' in entry: gczealValueFlag = True required = [] if options.enableSimulatorArm64: # This should get updated whenever ARM64 builds are stable, probably ~end-June 2015 required.append('25e99bc12482') # m-c 249239 Fx41, 1st w/--enable-simulator=[arm|arm64|mips], see bug 1173992 if "--ion-regalloc=testbed" in flags: required.append('47e92bae09fd') # m-c 248962 Fx41, 1st w/--ion-regalloc=testbed, see bug 1170840 if '--non-writable-jitcode' in flags: required.append('b46d6692fe50') # m-c 248578 Fx41, 1st w/--non-writable-jitcode, see bug 977805 if '--ion-extra-checks' in flags: required.append('cdf93416b39a') # m-c 234228 Fx39, 1st w/--ion-extra-checks, see bug 1139152 if '--no-cgc' in flags: required.append('b63d7e80709a') # m-c 227705 Fx38, 1st w/--no-cgc, see bug 1126769 and see bug 1129233 if '--unboxed-objects' in flags: required.append('7820fd141998') # m-c 225967 Fx38, 1st w/--unboxed-objects, see bug 1116855 if '--ion-sink=on' in flags: required.append('9188c8b7962b') # m-c 217242 Fx36, 1st w/--ion-sink=on, see bug 1093674 if gczealValueFlag: required.append('03c6a758c9e8') # m-c 216625 Fx36, 1st w/--gc-zeal=14, see bug 1101602 if '--no-incremental-gc' in flags: required.append('35025fd9e99b') # m-c 211115 Fx36, 1st w/--no-incremental-gc, see bug 958492 if '--ion-loop-unrolling=on' in flags: required.append('aa33f4725177') # m-c 198804 Fx34, 1st w/--ion-loop-unrolling=on, see bug 1039458 if '--no-threads' in flags: required.append('e8558ecd9b16') # m-c 195999 Fx34, 1st w/--no-threads, see bug 1031529 if sps.isMozBuild64 or options.enableNsprBuild: # 64-bit builds have peculiar complexities prior to this required.append('a459b02a9ca4') # m-c 194734 Fx33, 1st w/--enable-nspr-build, see bug 975011 if asmPoolMaxOffsetFlag: required.append('f114c4101f02') # m-c 194525 Fx33, 1st w/--asm-pool-max-offset=1024, see bug 1026919 if asmNopFillFlag: required.append('f1bacafe789c') # m-c 192164 Fx33, 1st w/--arm-asm-nop-fill=0, see bug 1020834 if offthreadCompileFlag: required.append('f0d67b1ccff9') # m-c 188901 Fx33, 1st w/--ion-offthread-compile=off, see bug 1020364 if '--no-native-regexp' in flags: required.append('43acd23f5a98') # m-c 183413 Fx32, 1st w/--no-native-regexp, see bug 976446 if options.enableSimulatorArm32: # --enable-arm-simulator became --enable-simulator=arm in rev 25e99bc12482 # but unknown flags are ignored, so we compile using both till Fx38 ESR is deprecated required.append('5ad5f92387a2') # m-c 179476 Fx31, see bug 1173992 if sps.isWin: required.append('abfaf0ccae19') # m-c 169626 Fx30, 1st w/reliably successful Win builds, see bug 974739 if sps.isMac: required.append('f9374ef0fbed') # m-c 163848 Fx29, prior builds have issues with Xcode 6.3 and above required.append('df3c2a1e86d3') # m-c 160479 Fx29, prior non-threadsafe builds act weirdly with threadsafe-only flags from later revs, see bug 927685 return "first((" + commonDescendants(required) + ") - (" + skipRevs + "))"
def earliestKnownWorkingRev(options, flags, skipRevs): ''' Returns a revset which evaluates to the first revision of the shell that compiles with |options| and runs jsfunfuzz successfully with |flags|. ''' assert (not sps.isMac) or (sps.macVer() >= [10, 7]) # Only Lion and above are supported with Clang 4. # These should be in descending order, or bisection will break at earlier changesets. offthreadCompileFlag = gczealValueFlag = False # flags is a list of flags, and the option must exactly match. for entry in flags: # What comes after these flags needs to be a number, so we look for the string instead. if '--ion-offthread-compile=' in entry: offthreadCompileFlag = True elif '--gc-zeal=' in entry: gczealValueFlag = True required = [] if options.enableSimulatorArm64: # This should get updated whenever ARM64 builds are stable, probably ~end-June 2015 required.append('25e99bc12482') # m-c 249239 Fx41, 1st w/--enable-simulator=[arm|arm64|mips], see bug 1173992 if "--ion-regalloc=testbed" in flags: required.append('47e92bae09fd') # m-c 248962 Fx41, 1st w/--ion-regalloc=testbed, see bug 1170840 if '--non-writable-jitcode' in flags: required.append('b46d6692fe50') # m-c 248578 Fx41, 1st w/--non-writable-jitcode, see bug 977805 if '--no-unboxed-objects' in flags: required.append('322487136b28') # m-c 244297 Fx41, 1st w/--no-unboxed-objects, see bug 1162199 if '--unboxed-arrays' in flags: required.append('020c6a559e3a') # m-c 242167 Fx40, 1st w/--unboxed-arrays, see bug 1146597 if '--ion-extra-checks' in flags: required.append('cdf93416b39a') # m-c 234228 Fx39, 1st w/--ion-extra-checks, see bug 1139152 if '--no-cgc' in flags: required.append('b63d7e80709a') # m-c 227705 Fx38, 1st w/--no-cgc, see bug 1126769 and see bug 1129233 if sps.isWin: required.append('8937836d3c93') # m-c 226774 Fx38, 1st w/ successful MSVC 2013 and 2015 builds, see bug 1119072 if sps.isLinux: required.append('6ec9033a4535') # m-c 217796 Fx36, previous builds fail on some Linux variants with different compiler versions if '--ion-sink=on' in flags: required.append('9188c8b7962b') # m-c 217242 Fx36, 1st w/--ion-sink=on, see bug 1093674 if gczealValueFlag: required.append('03c6a758c9e8') # m-c 216625 Fx36, 1st w/--gc-zeal=14, see bug 1101602 if '--no-incremental-gc' in flags: required.append('35025fd9e99b') # m-c 211115 Fx36, 1st w/--no-incremental-gc, see bug 958492 if '--ion-loop-unrolling=on' in flags: required.append('aa33f4725177') # m-c 198804 Fx34, 1st w/--ion-loop-unrolling=on, see bug 1039458 if '--no-threads' in flags: required.append('e8558ecd9b16') # m-c 195999 Fx34, 1st w/--no-threads, see bug 1031529 if options.enableNsprBuild: required.append('a459b02a9ca4') # m-c 194734 Fx33, 1st w/--enable-nspr-build, see bug 975011 if offthreadCompileFlag: required.append('f0d67b1ccff9') # m-c 188901 Fx33, 1st w/--ion-offthread-compile=off, see bug 1020364 if '--no-native-regexp' in flags: required.append('43acd23f5a98') # m-c 183413 Fx32, 1st w/--no-native-regexp, see bug 976446 if options.enableSimulatorArm32: # --enable-arm-simulator became --enable-simulator=arm in rev 25e99bc12482 # but unknown flags are ignored, so we compile using both till Fx38 ESR is deprecated required.append('5ad5f92387a2') # m-c 179476 Fx31, see bug 1173992 required.append('f9374ef0fbed') # m-c 163848 Fx29, prior builds have issues with Xcode 6.3 and above return "first((" + commonDescendants(required) + ") - (" + skipRevs + "))"
def earliestKnownWorkingRev(options, flags, skipRevs): ''' Returns a revset which evaluates to the first revision of the shell that compiles with |options| and runs jsfunfuzz successfully with |flags|. ''' assert (not sps.isMac) or ( sps.macVer() >= [10, 7] ) # Only Lion and above are supported with Clang 4. # These should be in descending order, or bisection will break at earlier changesets. offthreadCompileFlag = gczealValueFlag = False # flags is a list of flags, and the option must exactly match. for entry in flags: # What comes after these flags needs to be a number, so we look for the string instead. if '--ion-offthread-compile=' in entry: offthreadCompileFlag = True elif '--gc-zeal=' in entry: gczealValueFlag = True required = [] if "--ion-sincos=on" in flags: required.append( '3dec2b935295' ) # m-c 262544 Fx43, 1st w/--ion-sincos=on, see bug 984018 if "--ion-instruction-reordering=on" in flags: required.append( '59d2f2e62420' ) # m-c 259672 Fx43, 1st w/--ion-instruction-reordering=on, see bug 1195545 if "--ion-shared-stubs=on" in flags: required.append( '3655d19ce241' ) # m-c 257573 Fx43, 1st w/--ion-shared-stubs=on, see bug 1168756 if options.enableSimulatorArm64: # This should get updated whenever ARM64 builds are stable, probably ~end-June 2015 required.append( '25e99bc12482' ) # m-c 249239 Fx41, 1st w/--enable-simulator=[arm|arm64|mips], see bug 1173992 if "--ion-regalloc=testbed" in flags: required.append( '47e92bae09fd' ) # m-c 248962 Fx41, 1st w/--ion-regalloc=testbed, see bug 1170840 if '--non-writable-jitcode' in flags: required.append( 'b46d6692fe50' ) # m-c 248578 Fx41, 1st w/--non-writable-jitcode, see bug 977805 if '--no-unboxed-objects' in flags: required.append( '322487136b28' ) # m-c 244297 Fx41, 1st w/--no-unboxed-objects, see bug 1162199 if '--unboxed-arrays' in flags: required.append( '020c6a559e3a' ) # m-c 242167 Fx40, 1st w/--unboxed-arrays, see bug 1146597 if '--ion-extra-checks' in flags: required.append( 'cdf93416b39a' ) # m-c 234228 Fx39, 1st w/--ion-extra-checks, see bug 1139152 if '--no-cgc' in flags: required.append( 'b63d7e80709a' ) # m-c 227705 Fx38, 1st w/--no-cgc, see bug 1126769 and see bug 1129233 if sps.isWin: required.append( '8937836d3c93' ) # m-c 226774 Fx38, 1st w/ successful MSVC 2013 and 2015 builds, see bug 1119072 if sps.isLinux: required.append( '6ec9033a4535' ) # m-c 217796 Fx36, previous builds fail on some Linux variants with different compiler versions if '--ion-sink=on' in flags: required.append( '9188c8b7962b' ) # m-c 217242 Fx36, 1st w/--ion-sink=on, see bug 1093674 if gczealValueFlag: required.append( '03c6a758c9e8' ) # m-c 216625 Fx36, 1st w/--gc-zeal=14, see bug 1101602 required.append( '54be5416ae5d' ) # m-c 213474 Fx36, prior builds have issues with Xcode 7.0 and above return "first((" + commonDescendants(required) + ") - (" + skipRevs + "))"