WebAssembly / WebAssembly/wasi-sdk

debug info depends on -Wl,--export=

Open
#129 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
CMake
Stars
1.6k
Forks
237
Avg merge
18h 26m
Merged PRs (30d)
5

Description

When compiling a C program with -Wl,--export-all, more debug info is generated.

For example, take this program:

#include <stdio.h>
#include <errno.h>

int main() {
    FILE *f = fopen("/etc/issue", "r");
    if (!f) {
        return errno;
    }
    return fclose(f);
}

Compile with -g -O3 -Wl,--export-all and run wasm2wat

  (func $main (type $t0) (param $p0 i32) (param $p1 i32) (result i32)
    call $__original_main)

Now compile with -g -O3 -Wl,--export=main and run wasm2wat

  (func $main (type $t2) (param $p0 i32) (param $p1 i32) (result i32)
    call $f11)

Why is there a difference?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the C example with -g -O3 using both -Wl,--export-all and -Wl,--export=main, then inspect the resulting output with wasm2wat. Compare the generated function names, signatures, and debug information to determine why the export choice changes them; done means the behavior is explained and any needed wasi-sdk change is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, wasm
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.