5 dataSymbolsByAddress
= {}
7 versionedDataSymbolsByName
= {}
8 functionSymbolsByAddress
= {}
10 versionedFunctionSymbolsByName
= {}
12 for line
in sys
.stdin
.readlines():
14 # ignore lines without an address
17 (address
, type, symbol
) = line
.split()
19 # select interesting types of symbols
20 if type not in 'BCDGRSTuVvWw':
23 # drop symbols from legacy compiler that contain a dot (those produce
30 versionedDataSymbolsByName
[symbol
] = address
33 dataSymbolsByAddress
[address
] = symbol
34 dataSymbols
.append(symbol
)
37 versionedFunctionSymbolsByName
[symbol
] = address
40 functionSymbolsByAddress
[address
] = symbol
41 functionSymbols
.append(symbol
)
44 for dataSymbol
in sorted(dataSymbols
):
45 print 'int %s;' % dataSymbol
49 # add function symbols
50 for functionSymbol
in sorted(functionSymbols
):
51 print 'void %s() {}' % functionSymbol
54 print "#include <symbol_versioning.h>"
57 # add symbol versioning information for data symbols
58 for symbol
in sorted(versionedDataSymbolsByName
.keys()):
59 address
= versionedDataSymbolsByName
[symbol
]
60 targetSymbol
= dataSymbolsByAddress
[address
]
61 (symbolName
, unused
, versionTag
) = symbol
.partition('LIBROOT_')
62 print 'DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("%s", "%s", "%s");' \
63 % (targetSymbol
, symbolName
, versionTag
)
65 # add symbol versioning information for function symbols
66 for symbol
in sorted(versionedFunctionSymbolsByName
.keys()):
67 address
= versionedFunctionSymbolsByName
[symbol
]
68 targetSymbol
= functionSymbolsByAddress
[address
]
69 (symbolName
, unused
, versionTag
) = symbol
.partition('LIBROOT_')
70 print 'DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("%s", "%s", "%s");' \
71 % (targetSymbol
, symbolName
, versionTag
)