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

configure: add -Wl,--no-as-needed #4631

Merged
merged 2 commits into from
Jul 7, 2021
Merged

Conversation

shyouhei
Copy link
Member

@shyouhei shyouhei commented Jul 7, 2021

This is my take to fix #4627.

  • Instead of tweaking --with-jemalloc I opted to modity --enable-shared.
  • The linker flag is checked for availability.

Confirmed working for debian bullseye.

It is reported that combination of `--enable-shared --with-jemalloc`
breaks on Debian bullseye (testig).  Deeper investigation revealed that
this system's `ld(1)` is patched, to turn `ld --as-needed` on by
default.

This linker flag strips "unnecessary" library dependencies from an
executable.  In case of `ruby(1)` (of `--enable-shared`), because
everything is in `libruby.so`, the binary itself doesn't include any
calls to `malloc(3)` at all.  So in spite of our explicit `-ljemalloc`
flag, it is ignored.  Libc's one is chosen instead.

This is not what we want.  Let's force our `ruby(1)` link what we want.

Fixes ruby#4627

The author would like to acknowledge
Akihiko Odaki <akihiko.odaki@gmail.com> for their contributions.
@shyouhei shyouhei requested a review from nobu July 7, 2021 01:44
@shyouhei
Copy link
Member Author

shyouhei commented Jul 7, 2021

CC @akihikodaki

Copy link

@akihikodaki akihikodaki left a comment

Choose a reason for hiding this comment

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

It is a fix for a strange compiler configuration so I think it should have a comment which environment requires this change. Otherwise readers may wonder why it explicitly applies the configuration while it is default (for most situations).

@shyouhei
Copy link
Member Author

shyouhei commented Jul 7, 2021

That's reasonable. Will add soon.

@shyouhei shyouhei merged commit 82d4255 into ruby:master Jul 7, 2021
@shyouhei shyouhei deleted the no-as-needed branch July 9, 2021 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants