mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 23:06:00 +00:00
[APISETS] Stubplement versioned forwarders
This commit is contained in:
parent
1a964b5139
commit
6121df7321
1 changed files with 44 additions and 10 deletions
|
@ -17,7 +17,7 @@ SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||||
NL_CHAR = '\n'
|
NL_CHAR = '\n'
|
||||||
|
|
||||||
IGNORE_OPTIONS = ('-norelay', '-ret16', '-ret64', '-register', '-private',
|
IGNORE_OPTIONS = ('-norelay', '-ret16', '-ret64', '-register', '-private',
|
||||||
'-noname', '-ordinal', '-i386', '-arch=', '-stub')
|
'-noname', '-ordinal', '-i386', '-arch=', '-stub', '-version=')
|
||||||
|
|
||||||
# Figure these out later
|
# Figure these out later
|
||||||
FUNCTION_BLACKLIST = [
|
FUNCTION_BLACKLIST = [
|
||||||
|
@ -34,6 +34,16 @@ SPEC_HEADER = [
|
||||||
'\n'
|
'\n'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
ALIAS_DLL = {
|
||||||
|
'ucrtbase': 'msvcrt',
|
||||||
|
'kernelbase': 'kernel32',
|
||||||
|
'shcore': 'shlwapi',
|
||||||
|
'combase': 'ole32',
|
||||||
|
|
||||||
|
# These modules cannot be linked against in ROS, so forward it
|
||||||
|
'cfgmgr32': 'setupapi', # Forward everything
|
||||||
|
'wmi': 'advapi32', # Forward everything
|
||||||
|
}
|
||||||
|
|
||||||
class InvalidSpecError(Exception):
|
class InvalidSpecError(Exception):
|
||||||
def __init__(self, message):
|
def __init__(self, message):
|
||||||
|
@ -102,16 +112,20 @@ class Arch(object):
|
||||||
def __ne__(self, other):
|
def __ne__(self, other):
|
||||||
return not self.__eq__(other)
|
return not self.__eq__(other)
|
||||||
|
|
||||||
ALIAS_DLL = {
|
|
||||||
'ucrtbase': 'msvcrt',
|
|
||||||
'kernelbase': 'kernel32',
|
|
||||||
'shcore': 'shlwapi',
|
|
||||||
'combase': 'ole32',
|
|
||||||
|
|
||||||
# These modules cannot be linked against in ROS, so forward it
|
class VersionExpr(object):
|
||||||
'cfgmgr32': 'setupapi', # Forward everything
|
def __init__(self, text):
|
||||||
'wmi': 'advapi32', # Forward everything
|
self.text = text
|
||||||
}
|
self.parse()
|
||||||
|
|
||||||
|
def parse(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def to_str(self):
|
||||||
|
if self.text:
|
||||||
|
return '-version={}'.format(self.text)
|
||||||
|
return ''
|
||||||
|
|
||||||
|
|
||||||
class SpecEntry(object):
|
class SpecEntry(object):
|
||||||
def __init__(self, text, spec):
|
def __init__(self, text, spec):
|
||||||
|
@ -120,6 +134,7 @@ class SpecEntry(object):
|
||||||
self.callconv = None
|
self.callconv = None
|
||||||
self.name = None
|
self.name = None
|
||||||
self.arch = Arch()
|
self.arch = Arch()
|
||||||
|
self.version = None
|
||||||
self._forwarder = None
|
self._forwarder = None
|
||||||
self.init(text)
|
self.init(text)
|
||||||
self.noname = False
|
self.noname = False
|
||||||
|
@ -148,6 +163,8 @@ class SpecEntry(object):
|
||||||
while self.name.startswith(IGNORE_OPTIONS):
|
while self.name.startswith(IGNORE_OPTIONS):
|
||||||
if self.name.startswith('-arch='):
|
if self.name.startswith('-arch='):
|
||||||
self.arch.add(self.name[6:])
|
self.arch.add(self.name[6:])
|
||||||
|
elif self.name.startswith('-version='):
|
||||||
|
self.version = VersionExpr(self.name[9:])
|
||||||
elif self.name == '-i386':
|
elif self.name == '-i386':
|
||||||
self.arch.add('i386')
|
self.arch.add('i386')
|
||||||
self.name = tokens.pop(0)
|
self.name = tokens.pop(0)
|
||||||
|
@ -185,10 +202,12 @@ class SpecEntry(object):
|
||||||
module = module_lookup[module_name]
|
module = module_lookup[module_name]
|
||||||
fwd_arch = module.find_arch(self.name)
|
fwd_arch = module.find_arch(self.name)
|
||||||
callconv = module.find_callconv(self.name)
|
callconv = module.find_callconv(self.name)
|
||||||
|
version = module.find_version(self.name)
|
||||||
if fwd_arch:
|
if fwd_arch:
|
||||||
self.arch = fwd_arch
|
self.arch = fwd_arch
|
||||||
self._forwarder = [module_name, self.name]
|
self._forwarder = [module_name, self.name]
|
||||||
self.callconv = callconv
|
self.callconv = callconv
|
||||||
|
self.version = version
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@ -214,6 +233,7 @@ class SpecEntry(object):
|
||||||
mod = module_lookup[mod]
|
mod = module_lookup[mod]
|
||||||
self.arch = mod.find_arch(self.name)
|
self.arch = mod.find_arch(self.name)
|
||||||
self.callconv = mod.find_callconv(self.name)
|
self.callconv = mod.find_callconv(self.name)
|
||||||
|
self.version = mod.find_version(self.name)
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@ -232,6 +252,8 @@ class SpecEntry(object):
|
||||||
estimate_size = 0
|
estimate_size = 0
|
||||||
if self.noname:
|
if self.noname:
|
||||||
opts = '{} -noname'.format(opts)
|
opts = '{} -noname'.format(opts)
|
||||||
|
if self.version:
|
||||||
|
opts = '{} {}'.format(opts, self.version.to_str())
|
||||||
if self.name == '@':
|
if self.name == '@':
|
||||||
assert self._ord != '@'
|
assert self._ord != '@'
|
||||||
name = 'Ordinal' + self._ord
|
name = 'Ordinal' + self._ord
|
||||||
|
@ -310,6 +332,18 @@ class SpecFile(object):
|
||||||
callconv = func.callconv
|
callconv = func.callconv
|
||||||
return callconv
|
return callconv
|
||||||
|
|
||||||
|
def find_version(self, name):
|
||||||
|
functions = self.find(name)
|
||||||
|
version = None
|
||||||
|
if functions:
|
||||||
|
for func in functions:
|
||||||
|
if not func.version:
|
||||||
|
continue
|
||||||
|
if version:
|
||||||
|
assert version.text == func.version.text
|
||||||
|
version = func.version
|
||||||
|
return version
|
||||||
|
|
||||||
def resolve_forwarders(self, module_lookup):
|
def resolve_forwarders(self, module_lookup):
|
||||||
modules = self.forwarder_modules()
|
modules = self.forwarder_modules()
|
||||||
total = 0
|
total = 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue