Commit f75a5e56 authored by Carsten Emde's avatar Carsten Emde
Browse files

If the target option is used: check for link compatibility between targets and...

If the target option is used: check for link compatibility between targets and only consider files that are link compatible with first target
parent 21441a4b
......@@ -82,6 +82,42 @@ def createoutput(outputdir, outputformat, machine_to_binary, linked_libraries,
for target in targets:
if not target.startswith("/"):
targets[targets.index(target)] = "/" + targets[targets.index(target)]
target_architecture = ''
target_machine = ''
target_endian = ''
target_elfclass = ''
for target in targets:
try:
for architecture in machine_to_binary:
for o in machine_to_binary[architecture]:
for endian in machine_to_binary[architecture][o]:
for elfclass in machine_to_binary[architecture][o][endian]:
for filename in machine_to_binary[architecture][o][endian][elfclass]:
if filename == target:
if target_architecture == '':
target_architecture = architecture
else:
if architecture != target_architecture:
print("Info: Architecture of target %s (%s) is different from architecture of first target (%s)" % (target, architecture, target_architecture))
if target_machine == '':
target_machine = o
else:
if o != target_machine:
print("Info: Machine of target %s (%s) is different from machine of first target (%s)" % (target, o, target_machine))
if target_endian == '':
target_endian = endian
else:
if endian != target_endian:
print("Info: Endian of target %s (%s) is different from endian of first target (%s)" % (target, endian, target_endian))
if target_elfclass == '':
target_elfclass = elfclass
else:
if elfclass != target_elfclass:
print("Info: Elfclass of target %s (%s) is different from elfclass of first target (%s)" % (target, elfclass, target_elfclass))
raise StopIteration
except StopIteration:
pass
limitsearch = targets
# Create list of dependent files of targets to restrict the search to
......@@ -103,10 +139,10 @@ def createoutput(outputdir, outputformat, machine_to_binary, linked_libraries,
fullfilename = symlink_to_target[fullfilename]
if fullfilename not in limitsearch:
limitsearch.append(fullfilename)
print("Info: Limiting search to %s" % (limitsearch))
if (len(limitsearch) == 1):
print("Info: No libraries found, halting program execution")
return
print("Info: Limiting search to %s" % (limitsearch))
if outputformat == 'cypher':
newline = ", \n"
......@@ -114,9 +150,17 @@ def createoutput(outputdir, outputformat, machine_to_binary, linked_libraries,
newline = "\n"
for architecture in machine_to_binary:
if architecture != target_architecture:
continue
for o in machine_to_binary[architecture]:
if o != target_machine:
continue
for endian in machine_to_binary[architecture][o]:
if endian != target_endian:
continue
for elfclass in machine_to_binary[architecture][o][endian]:
if elfclass != target_elfclass:
continue
elf_to_placeholder = {}
placeholder_to_elf = {}
symbol_to_placeholder = {}
......@@ -693,6 +737,9 @@ def main(argv):
architecture = elfheader['e_machine']
elf_endian = elffilerepresentation.little_endian
operating_system = elfheader['e_ident']['EI_OSABI']
if operating_system == 'ELFOSABI_STANDALONE':
openedelffile.close()
continue
if operating_system == 'ELFOSABI_LINUX':
operating_system = 'ELFOSABI_SYSV'
elfclass = elffilerepresentation.elfclass
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment