Skip to content

Conversation

@hoodmane
Copy link
Collaborator

@hoodmane hoodmane commented May 22, 2023

Resolves #16680.

Why is the current behavior broken?

Well what is "broken" from my specific perspective is the failure on the main branch of the added test:

  def test_lc_side_module(self):
    create_file('side.c', 'int sidey() { return 42; }')
    self.run_process([EMCC, '-sSIDE_MODULE', 'side.c', '-o', 'libside.so', '-lc'])

Rust, the libpng makefile, and various other tools pass -lc when they try to link shared libraries. It would be nice for it to work.

@sbc100
Copy link
Collaborator

sbc100 commented May 22, 2023

Can you describe in the PR description what you mean by "don't break"? Why is broken with the current behaviour?

continue
lib = strip_prefix(flag, '-l')
if lib == "c":
continue
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if we should instead avoid adding native_lib to forced_stdlibs on line 4180, and if we should do it for all native system libs.. do we ever want to allow the side module to include a system library? Shouldn't they always get linking into the main module?

Perhaps we should at least do this for all default libraries (e.g. libc++, libcompiler_rt, etc)

@hoodmane hoodmane closed this Oct 16, 2024
@hoodmane
Copy link
Collaborator Author

Closing because the bug seems to have been fixed by other code changes.

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

Successfully merging this pull request may close these issues.

bug: Emscripten doesn't generate PIC libc

2 participants