Some foreign code that I have built using Emscripten interptrets structured binary data (that may be located in arbitrarrily aligned/unaligned memory buffers).
To access the attributes of certain data structures contained in that binary buffer the logic uses various "packed structs" (that have respective getter-methods for the attributes). It determines some starting address within the memory buffer via pointer arithmetic and then points some "packed struct" that is meant to access the attributes directly to that address. Currently the Emscripten compiled code works sometimes and sometimes it does not. (i.e.it seems to depend on the input file type if it does) I havn't performed an in-depth analysis yet but I guess that alignment issues might be a likely cause of the problems. (indeed the use of *-s SAFE_HEAP=1* <http://kripken.github.io/emscripten-site/docs/porting/Debugging.html#debugging-safe-heap> reveiled respective execptions..) I already patched the structs as suggested in the "Memory Alignment Issues" section here: http://kripken.github.io/emscripten-site/docs/porting/Debugging.html, i.e. I introduced respective typedefs for all the multi-byte data types: typedef uint16_t __attribute__((aligned(1))) my_align1_uint16_t; Unfortunately this did not help.. I imagine that the alignment of the struct itself might still be an issue.. (because the binary data can start anywhere in the respective char[].. and maybe the compiler expects that that the struct itself always starts on some "int" aligned address..?) Is this a known problem (with some known solution).. so I can save myself the trouble to do some serious analysis? -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
