Coder Social home page Coder Social logo

Comments (3)

sbc100 avatar sbc100 commented on May 30, 2024 1

Thanks for the report. We should certainly fix this (either by disallowing explicit -Wl,--stack-first or honoring it).

The reason that folks generally prefer --stack-first, and the reason emscripten uses it in debug builds, is that you get better stack overflow reporting. i.e. stack overflows will trap right away.

from emscripten.

sbc100 avatar sbc100 commented on May 30, 2024

The problem is that emscripten itself wants to control the --stack-first linker flag.

See

emscripten/tools/link.py

Lines 882 to 888 in 0e5b3a8

if 'GLOBAL_BASE' not in user_settings and not settings.SHRINK_LEVEL and not settings.OPT_LEVEL:
# When optimizing for size it helps to put static data first before
# the stack (since this makes instructions for accessing this data
# use a smaller LEB encoding).
# However, for debugability is better to have the stack come first
# (because stack overflows will trap rather than corrupting data).
settings.STACK_FIRST = True

And:

if settings.STACK_FIRST:
cmd.append('--stack-first')

The idea is that we use stack-first in debug builds, but not in optimizing builds. Is there some reason you want the stack to be first, even in optimized builds?

from emscripten.

netogallo avatar netogallo commented on May 30, 2024

Thank you for letting me know. What you say is sensible. In case you are curious, the reason why I am attempting that is because I am trying to build GHC using the upstream emsdk (rather than using the wasm-sdk fork). The instructions use both flags: https://gitlab.haskell.org/ghc/ghc-wasm-meta#set-environment-variables

I don't know why they use "--stack-first" in all honesty, it might not be necessary as you say. This issue does not affect me as I can get around it. I was just reporting what I encountered. Feel free to close.

from emscripten.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.