Resolve https://bugs.llvm.org/show_bug.cgi?id=35928 to promote Swift for WebAssembly
__clang_ast section should be aligned by 4 bytes, so I added padding after the size of custom section name.
kateinoigakukun on Feb 13 2020, 1:37 AM.Authored by
My colleague pointed out that one way to archive padding in the binary format would be to create a synthetic custom section that precedes that one you want to align. Its kind of horrible, but wasm files were not designed to used memory mapped like this.
Thanks! I'll try this way. My only concern is whether the order of custom sections are guaranteed.
If you simple create the extra section right there in the WasmObjectFileWriter it will be in the right order. I wasn't recommending creating an extra section at the llvm level.
I just landed https://reviews.llvm.org/D77115 which does similar thing for the embedded bitcode sections and should simplify this CL a little. Although it doesn't try to do the file offset alignment.
If we can figure out way to do alignment I think that is the only remaining blocker for this.