Skip to content

error on undefined main symbol by default #9640

Closed
@sbc100

Description

@sbc100

Currently emscripten tries to make the main symbol optional, so that some programs (in particular library that export functions but have no entry point) can be built with no main all.

While this feature is convenient if make the code in emscripten more complicated since there is no way to know ahead of time (before linking) if a program has an entry point or not. In particualar there are two places in the codebase were we try to detect if main is present. The first is HAS_MAIN in jsifier, and the second is Building.link_lld. In both cases we get false positives because main is often in EXPORTED_FUNCTIONS even when there is no main.

My proposed solution is to force such users to pass a certain link flag (e.g. -mno-entry or -fno-entry) which will allow emscripten to know what type of program is being built.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions