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

debug info depends on -Wl,--export= #129

Open
jendrikw opened this issue Apr 27, 2020 · 4 comments
Open

debug info depends on -Wl,--export= #129

jendrikw opened this issue Apr 27, 2020 · 4 comments

Comments

@jendrikw
Copy link

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?

@sunfishcode
Copy link
Member

Do you have wasm-opt in your PATH? If so, clang runs it at -O3, and it may be doing optimizations which change the names.

@jendrikw
Copy link
Author

Thanks for the hint. I do have wasm-opt on my path and can confirm that clang calls it. A discussion about disabling wasm-opt and how to pass options is happening at https://reviews.llvm.org/D70500. Let's wait for the discussion to settle.

@jendrikw
Copy link
Author

jendrikw commented May 7, 2020

Also related: "wasm-opt strips symbol names when optimizing" https://bugs.llvm.org/show_bug.cgi?id=45602

kildom pushed a commit to kildom/clang-wasi-port that referenced this issue Jul 14, 2021
Don't ignore paths which don't have the required rights. This means
that if the lookup finds a path that doesn't have the required
rights, it'll just proceed to the actual operation which will fail
with `ENOTCAPABLE`.

Intuitively, use cases which would depend on having multiple
overlapping matching paths for a given lookup and intelligently
picking the one with the required rights seems like they should
be uncommon.

This is simpler overall, and requires less code.
alexcrichton pushed a commit to alexcrichton/wasi-sdk that referenced this issue Apr 5, 2023
This brings in the following changes:

f645f49 Update signal macros after upgrade to snapshot1 (WebAssembly#144)
8b3266d github actions: pin checkout action to v1 (WebAssembly#145)
410c660 Use constructor functions for optional init routines. (WebAssembly#142)
fe13053 c header generation updated for reorganized witx ast (WebAssembly#139)
cd74e1d Correct the version of WebAssembly#136 on master (WebAssembly#141)
446cb3f Wasi snapshot preview1 (WebAssembly#140)
54102f0 Ignore rights in libpreopen. (WebAssembly#129)
8c9e1c6 Make the `__original_main` definition weak, fixing -flto. (WebAssembly#138)
cf81683 Optimize `fmin`, `fmax`, etc. (WebAssembly#120)
deb8eae Don't pre-check capabilities in `openat`. (WebAssembly#130)
ca9046d Use consistent style for wasi-libc C source files. (WebAssembly#131)
951cc3e Fix unintended recursion in __wasilibc_register_preopened_fd. (WebAssembly#133)
5216983 Avoid a `strdup` call in `__wasilibc_populate_libpreopen`. (WebAssembly#128)
70099d4 Don't link in libpreopen initialization code when it isn't needed. (WebAssembly#127)
ec4549d Temporarily disable the use of `__heap_base`. (WebAssembly#132)
a214f1c Use __heap_base by dlmalloc (WebAssembly#114)
a94d2d0 Avoid varargs conventions when calling open (WebAssembly#126)
7fcc4f2 Revamp and simplify the libpreopen code. (WebAssembly#110)
eb7230c Remove more unsupported headers. (WebAssembly#123)
@abrown
Copy link
Collaborator

abrown commented Aug 8, 2023

I think this is related to llvm/llvm-project#55781.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants