Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MODE=gnu-ld produces broken .c files #96

Closed
jacadcaps opened this issue Mar 23, 2024 · 1 comment · Fixed by #97
Closed

MODE=gnu-ld produces broken .c files #96

jacadcaps opened this issue Mar 23, 2024 · 1 comment · Fixed by #97
Labels
bug Something isn't working

Comments

@jacadcaps
Copy link

jacadcaps commented Mar 23, 2024

When trying to build the included python example:

$ ../../w2c2/w2c2 -d gnu-ld -f 100 python.wasm python.c
w2c2: skipping custom section 'producers' (size 85)
w2c2: skipping custom section 'target_features' (size 28)
make -fSubmake CC="cc" CFLAGS="-I../../w2c2 -O0 -g" LDFLAGS="-lm -L../../wasi -lw2c2wasi" OBJS="datasegments.o"
cc -I.. -I../../w2c2 -O0 -g -c python.c -o python.o
ld -r -b binary -o datasegments.o datasegments
python.c:8:17: error: invalid suffix "const" on integer constant
    8 | const U8* d0=ds+0const U8* d1=ds+5const U8* d2=ds+18const U8* d3=ds+29const U8* d4=ds+48const U8* d5=ds+83const U8* d6=ds+88const U8* d7=ds+169const U8* d8=ds+176const U8* d9=ds+177const U8* d10=ds+190const U8* d11=ds+191const U8* d12=ds+209const U8* d13=ds+218const U8* d14=ds+228const U8* d15=ds+239const U8* d16=ds+258const U8* d17=ds+293const U8* d18=ds+297const U8* d19=ds+417const U8* d20=ds+419const U8* d21=ds+420const U8* d22=ds+438const U8* d23=ds+447const U8* d24=ds+453const U8* d25=ds+464const U8* d26=ds+483const U8* d27=ds+518const U8* d28=ds+523const U8* d29=ds+560const U8* d30=ds+637const U8* d31=ds+639const U8* d32=ds+640const U8* d33=ds+658const U8* d34=ds+667const U8* d35=ds+677const U8* d36=ds+680constU8* d37=ds+689const U8* d38=ds+692const U8* d39=ds+708const U8* d40=ds+713const U8* 

Confirmed on Ubuntu and macOS.

@turbolent turbolent added the bug Something isn't working label Mar 25, 2024
@turbolent
Copy link
Owner

Thanks for the bug report!

Looks like I broke non-array data segments in #90, I'll fix that soon.

In the meantime you can build using arrays for data segments: make MODE=arrays / w2c2 -d arrays

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants