-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
llvm/llvm-project
#127735Description
Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 4.0.3 (a9651ff57165f5710bb09a5fe52590fd6ddb72df)
clang version 21.0.0git (https:/github.com/llvm/llvm-project 6dc41a639334b913e762f65410fcd14a722b137f)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /home/skuller/src/emsdk/upstream/bin
Sample program:
#include <stdio.h>
char test[1024*1024*50];
int main(void)
{
puts(test);
return 0;
}
Compiler command line:
emcc -o test.wasm -O3 -sMAIN_MODULE=<X> -sTOTAL_MEMORY=200MB test.c
Problem description:
When compiling above program with -sMAIN_MODULE=0
resulting test.wasm
binary size is 2 KB, but with -sMAIN_MODULE=1
it increases to 52 MB. Maybe I'm missing something, but is such dramatic code size increase normal/expected? I can compress the output, sure (it compresses well since it's mostly zeros), but isn't Emscripten all about minimizing code size for use on the web?
This behavior stays the same with -sMAIN_MODULE=2
. wasm-objdump -h
shows there's a huge Data
section consisting mostly of zeros:
Data start=0x00002077 end=0x03202730 (size=0x032006b9) count: 1
My apologies if this is a known/duplicate issue but I couldn't find any similar bug report.
Metadata
Metadata
Assignees
Labels
No labels