Files
roytam1 a128924c0d import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 930414 - Instantiate module function defintions earlier as per the spec r=shu (c0f7f01c16)
- Bug 819125 - Reset return value before executing catch/finally block. r=jandem (005fc7dc26)
- Bug 1216623 - Part 2: In for (let ...) loops, evaluate initializers in the scope of the variables being initialized. r=Waldo. (a09e74569a)
- Bug 1219877 - Allow let token with TOK_NAME in strict mode in Parser::shouldParseLetDeclaration. r=shu (d76dbab3d4)
- Bug 932517 - Followup: remove let-block logic in sloppy mode ES6 let declaration check. (rs=evilpie) (c6e0c8661a)
- Bug 1212305: Also mark lazy link frames, r=jandem (cd3601052c)
- Bug 1216140 - Load the global lexical scope for the BINDGNAME Baseline IC when the script doesn't have a non-syntactic scope chain. (r=jandem) (370cccbd8a)
- Bug 1144630 - Install class methods as non-enumerable on instances. (r=evilpie) (1158b1ffdb)
- Bug 1218639 - IonMonkey: MIPS64: Add support into jit. r=nbp (f521201ec3)
- Bug 1213740 - IonMonkey: MIPS64: Import Bailouts-mips64. r=nbp f=rankov (5e810a94d9)
- Bug 1213741 - IonMonkey: MIPS64: Import BaselineCompiler-mips64. r=nbp f=rankov (c6eb2d72b1)
- Bug 1213742 - IonMonkey: MIPS64: Import BaselineIC-mips64. r=nbp f=rankov (67b78d1345)
- Bug 1213745 - IonMonkey: MIPS64: Import Lowering-mips64. r=nbp f=rankov (d1e60521f2)
- Bug 1213749 - IonMonkey: MIPS64: Import SharedIC-mips64. r=nbp f=rankov (4a2184d535)
- Bug 1213750 - IonMonkey: MIPS64: Import Trampoline-mips64. r=nbp f=rankov (382237c7db)
- Bug 1213743 - IonMonkey: MIPS64: Import CodeGenerator-mips64. r=lth f=nbp,rankov (4f7d1720d6)
- Bug 1213747 - IonMonkey: MIPS64: Import MoveEmitter-mips64. r=nbp f=rankov (63a53396e6)
- Bug 1213751 - IonMonkey: MIPS64: Import Simulator-mips64. r=jandem (ac2f67fd43)
- Bug 1218652 - IonMonkey: MIPS: Add mips-shared in check macroassembler style. r=arai (cf6f2bf5db)
- Bug 1205134 - IonMonkey: MIPS: Split shareable code to mips-shared in MacroAssembler-mips32. r=lth f=nbp (3608ef227a)
- Bug 1218652 - IonMonkey: MIPS: Move shared functions to mips-shared. r=arai (d716fa56bc)
- Bug 1219137 - IonMonkey: MIPS: Fix PushRegsInMask and PopRegsInMaskIgnore can not shared. r=arai (13e5811e19)
- Bug 1213746 - IonMonkey: MIPS64: Import MacroAssembler-mips64. r=lthf=rankov (3a7cb6fbd6)
- Bug 1196545 - unboxed array snafus. r=jandem (31bbe773b2)
- Bug 1224411 - Speed up FileRegistry._partial_paths by memoizing on the basis of directory. r=nalexander (d202d614a9)
- Bug 1153790 - mac unification doesn't work with packaged addons. r=glandium (269cc3e37c)
- Bug 1208320 - Support configuring zlib compression level; r=glandium (502de5e78a)
- Bug 1163077 - Never elfhack if --disable-compile-environment is set. r=glandium (a484cb9a2f)
- Bug 1213418 - Part 1: Use mozregression to download in |mach artifact|. r=me (93e1cb3aa2)
- Bug 1213418 - Part 2: Use Fennec APKs in |mach artifact|; use mozversion to extract build IDs. r=me (27efbe8404)
- Bug 1191051 - Use full 40 character hashes in |mach artifact|. r=gps (43992efbee)
- Bug 1192064 - Add 'android-x86' job to |mach artifact|. r=jonalmeida (c0e7d6c8f8)
- No bug - Don't write artifacts twice. r=me (e5eff7d6de)
- Bug 1208808 - Move time zone adjustment information out of JSRuntime, into global state protected by a spinlock. r=till (20c6e76cc7)
- Bug 1181612: Rename AsmJSFunctionLabels to make them easier to understand; r=luke (c6d88f944b)
- Bug 1181612: Remove FunctionCompiler's RetType; r=luke (2f7483bfe2)
- Bug 1214467 - Eliminate redundant loop header phis while emitting MIR for asm.js. r=luke (6c50f9b407)
- Bug 1205390 - make Odin accept TypedArray constructors for shared memory. r=luke (400f892775)
- Bug 1181612: Make asm.js internal calls thread-local; r=luke (aed88de095)
- Bug 1219143 - IonMonkey: MIPS: Move callAndPushReturnAddress to mips-shared. r=lth (b9cd97f491)
- Bug 1217326 - fork remaining atomics. r=h4writer. (65cc2a2b07)
2022-10-28 23:01:13 +08:00

125 lines
3.9 KiB
Python

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import
import os
import struct
import subprocess
from mozpack.errors import errors
MACHO_SIGNATURES = [
0xfeedface, # mach-o 32-bits big endian
0xcefaedfe, # mach-o 32-bits little endian
0xfeedfacf, # mach-o 64-bits big endian
0xcffaedfe, # mach-o 64-bits little endian
]
FAT_SIGNATURE = 0xcafebabe # mach-o FAT binary
ELF_SIGNATURE = 0x7f454c46 # Elf binary
UNKNOWN = 0
MACHO = 1
ELF = 2
def get_type(path):
'''
Check the signature of the give file and returns what kind of executable
matches.
'''
with open(path, 'rb') as f:
signature = f.read(4)
if len(signature) < 4:
return UNKNOWN
signature = struct.unpack('>L', signature)[0]
if signature == ELF_SIGNATURE:
return ELF
if signature in MACHO_SIGNATURES:
return MACHO
if signature != FAT_SIGNATURE:
return UNKNOWN
# We have to sanity check the second four bytes, because Java class
# files use the same magic number as Mach-O fat binaries.
# This logic is adapted from file(1), which says that Mach-O uses
# these bytes to count the number of architectures within, while
# Java uses it for a version number. Conveniently, there are only
# 18 labelled Mach-O architectures, and Java's first released
# class format used the version 43.0.
num = f.read(4)
if len(num) < 4:
return UNKNOWN
num = struct.unpack('>L', num)[0]
if num < 20:
return MACHO
return UNKNOWN
def is_executable(path):
'''
Return whether a given file path points to an executable or a library,
where an executable or library is identified by:
- the file extension on OS/2 and WINNT
- the file signature on OS/X and ELF systems (GNU/Linux, Android, BSD,
Solaris)
As this function is intended for use to choose between the ExecutableFile
and File classes in FileFinder, and choosing ExecutableFile only matters
on OS/2, OS/X, ELF and WINNT (in GCC build) systems, we don't bother
detecting other kind of executables.
'''
from buildconfig import substs
if not os.path.exists(path):
return False
if substs['OS_ARCH'] == 'WINNT':
return path.lower().endswith((substs['DLL_SUFFIX'],
substs['BIN_SUFFIX']))
return get_type(path) != UNKNOWN
def may_strip(path):
'''
Return whether strip() should be called
'''
from buildconfig import substs
return not substs['PKG_SKIP_STRIP']
def strip(path):
'''
Execute the STRIP command with STRIP_FLAGS on the given path.
'''
from buildconfig import substs
strip = substs['STRIP']
flags = substs['STRIP_FLAGS'].split() if 'STRIP_FLAGS' in substs else []
cmd = [strip] + flags + [path]
if subprocess.call(cmd) != 0:
errors.fatal('Error executing ' + ' '.join(cmd))
def may_elfhack(path):
'''
Return whether elfhack() should be called
'''
# elfhack only supports libraries. We should check the ELF header for
# the right flag, but checking the file extension works too.
from buildconfig import substs
return ('USE_ELF_HACK' in substs and substs['USE_ELF_HACK'] and
path.endswith(substs['DLL_SUFFIX']) and
'COMPILE_ENVIRONMENT' in substs and substs['COMPILE_ENVIRONMENT'])
def elfhack(path):
'''
Execute the elfhack command on the given path.
'''
from buildconfig import topobjdir
cmd = [os.path.join(topobjdir, 'build/unix/elfhack/elfhack'), path]
if 'ELF_HACK_FLAGS' in os.environ:
cmd[1:0] = os.environ['ELF_HACK_FLAGS'].split()
if subprocess.call(cmd) != 0:
errors.fatal('Error executing ' + ' '.join(cmd))