Commit 6ec2a626 authored by Carsten Emde's avatar Carsten Emde
Browse files

Warn, if a symbol is exported by more than a single ELF file

parent 3edcf88f
......@@ -302,6 +302,7 @@ def createoutput(outputdir, outputformat, machine_to_binary, linked_libraries,
outputfileopen.write("\n</nodes>")
outputfileopen.write("\n<edges>")
exported_symbols_to_elf = {}
# then declare for all the symbols which are exported
for filename in machine_to_binary[architecture][o][endian][elfclass]:
if notarget(filename, limitsearch):
......@@ -340,6 +341,9 @@ def createoutput(outputdir, outputformat, machine_to_binary, linked_libraries,
elif outputformat == 'text':
outputfileopen.write("%s EXPORTS %s" % (filename, exp['name']))
exportedsymbols += 1
if exp['name'] not in exported_symbols_to_elf:
exported_symbols_to_elf[exp['name']] = []
exported_symbols_to_elf[exp['name']].append(filename)
if exportedsymbols == 0 and targets != [] and filename not in targets:
files_without_exports.add(filename)
for l in linked_libraries[filename]:
......@@ -350,6 +354,10 @@ def createoutput(outputdir, outputformat, machine_to_binary, linked_libraries,
if otherfilename not in files_without_exports:
files_without_exports.add(otherfilename)
for symbol in exported_symbols_to_elf:
if len(exported_symbols_to_elf[symbol]) > 1:
print("Warning: Symbol '%s' found more than once in %s" % (symbol, exported_symbols_to_elf[symbol]))
if files_without_exports != set():
print("Warning: Linked but unused files %s found and marked as such" % (files_without_exports))
......
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