diff options
author | alexv-smirnov <[email protected]> | 2023-03-15 19:59:12 +0300 |
---|---|---|
committer | alexv-smirnov <[email protected]> | 2023-03-15 19:59:12 +0300 |
commit | 056bb284ccf8dd6793ec3a54ffa36c4fb2b9ad11 (patch) | |
tree | 4740980126f32e3af7937ba0ca5f83e59baa4ab0 /build/scripts/rodata2asm.py | |
parent | 269126dcced1cc8b53eb4398b4a33e5142f10290 (diff) |
add library/cpp/actors, ymake build to ydb oss export
Diffstat (limited to 'build/scripts/rodata2asm.py')
-rw-r--r-- | build/scripts/rodata2asm.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/build/scripts/rodata2asm.py b/build/scripts/rodata2asm.py new file mode 100644 index 00000000000..555639499f2 --- /dev/null +++ b/build/scripts/rodata2asm.py @@ -0,0 +1,31 @@ +import os +import argparse + + +def main(): + parser = argparse.ArgumentParser(description='Convert rodata into asm source with embedded file content') + parser.add_argument('symbol', help='symvol name exported from generated filr') + parser.add_argument('rodata', help='input .rodata file path') + parser.add_argument('asm', type=argparse.FileType('w', encoding='UTF-8'), help='destination .asm file path') + parser.add_argument('--elf', action='store_true') + + args = parser.parse_args() + + file_size = os.path.getsize(args.rodata) + + args.asm.write('global ' + args.symbol + '\n') + args.asm.write('global ' + args.symbol + 'Size' + '\n') + args.asm.write('SECTION .rodata ALIGN=16\n') + args.asm.write(args.symbol + ':\nincbin "' + args.rodata + '"\n') + args.asm.write('align 4, db 0\n') + args.asm.write(args.symbol + 'Size:\ndd ' + str(file_size) + '\n') + + if args.elf: + args.asm.write('size ' + args.symbol + ' ' + str(file_size) + '\n') + args.asm.write('size ' + args.symbol + 'Size 4\n') + + args.asm.close() + + +if __name__ == '__main__': + main() |