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

Document the -Wl,--stack-first option to clang. #2703

Merged
merged 2 commits into from
Mar 3, 2021

Conversation

sunfishcode
Copy link
Member

As discussed in WebAssembly/wasi-libc#233, document the
-Wl,--stack-first option to help users diagnose stack overflow errors.

As discussed in WebAssembly/wasi-libc#233, document the
`-Wl,--stack-first` option to help users diagnose stack overflow errors.
that stack overflow will often lead to corrupted globals. The
`-Wl,--stack-first` flag to clang instructs it to put the stack first, followed
by the globals and the heap, which may produce slightly larger code, but will
more reliably trap on stack overflow.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth linking to https://lld.llvm.org/WebAssembly.html so folks find discover other useful linker flags?

How about For more information on this and other linker flags supported by wasm-ld see https://lld.llvm.org/WebAssembly.html.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Seems that some useful flags are not described on the page, such as --growable-table and --export. I assume it is not actively being updated. Maybe ./wasm-ld --help would be more extensive, but one cannot see it online. It's also not described on that page of flags.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be out of date, but that is not indented. Its generated directly from this file in the llvm source tree so it probably just needs an update: https://github.com/llvm/llvm-project/blob/main/lld/docs/WebAssembly.rst. Linking to something readable online is think is better than assuming the reader has a command line to hand.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That document also has more useful information about the linker in addition to what --help provides.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good thought; I'd now added a link to the lld WebAssembly docs.

@github-actions github-actions bot added the wasmtime:docs Issues related to Wasmtime's documentation label Mar 3, 2021
@sunfishcode sunfishcode merged commit 81c67d9 into bytecodealliance:main Mar 3, 2021
@sunfishcode sunfishcode deleted the sunfishcode/docs branch March 3, 2021 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasmtime:docs Issues related to Wasmtime's documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants