Skip to content

Dynamic linking breaks with exportet non-JavaScript Identifiers #27611

Description

@HendrikHuebner

Hi,
I'm working on support for GNUStep/Objective-C.

When building an Objective-C library as a SIDE_MODULE, emscripten may create JavaScript declarations for exported symbols.
This is a problem for Objective-C, since it needs to export compiler-generated globals, such as .objc_ctor and the Objective-C class metadata.
Emscripten then tries to declare the exported symbols as JavaScript variables.

This is essentially a broader version of the issue that was fixed here: #25922, because the previous fixes still do not solve the problem for emscripten's dynamic linking.

I don't know enough about the dynamic linking internals to fix this myself, so I'd appreciate some guidance.
Perhaps it would be possible to either:

  • "mangle" invalid JS identifiers, for example by treating $ as an escape character and replacing . with $dot and $ with $$ or something like that
  • Avoid declaring JavaScript variables and object-properties with the same name as the exported symbols

Best,
Hendrik

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