Skip to content

Commit

Permalink
Remove some unnecessary link annotations (#11563)
Browse files Browse the repository at this point in the history
Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>
Co-authored-by: Oleh Prypin <oleh@pryp.in>
  • Loading branch information
3 people authored Jan 29, 2022
1 parent 773d707 commit 2d4c35f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/crystal/system/unix/lib_event2.cr
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
require "c/netdb"

{% if flag?(:linux) %}
# MUSL: On musl systems, librt is empty. The entire library is already included in libc.
# The empty library is only available for POSIX compatibility. We don't need to link it.
{% if flag?(:linux) && !flag?(:musl) %}
@[Link("rt")]
{% end %}

Expand Down
7 changes: 6 additions & 1 deletion src/gc/boehm.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
require "crystal/rw_lock"
{% end %}

{% unless flag?(:win32) %}
# MUSL: On musl systems, libpthread is empty. The entire library is already included in libc.
# The empty library is only available for POSIX compatibility. We don't need to link it.
#
# OTHERS: On other systems, we add the linker annotation here to make sure libpthread is loaded
# before libgc which looks up symbols from libpthread.
{% unless flag?(:win32) || flag?(:musl) %}
@[Link("pthread")]
{% end %}

Expand Down
6 changes: 0 additions & 6 deletions src/gc/none.cr
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
{% unless flag?(:win32) %}
@[Link("pthread")]
lib LibC
end
{% end %}

module GC
def self.init
end
Expand Down
5 changes: 4 additions & 1 deletion src/math/libm.cr
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# MUSL: On musl systems, libm is empty. The entire library is already included in libc.
# The empty library is only available for POSIX compatibility. We don't need to link it.
#
# Interpreter: On GNU systems, libm.so is typically a GNU ld script which adds
# the actual library file to the load path. `Crystal::Loader` does not support
# ld scripts yet. So we just skip that for now. The libm symbols are still
# available in the interpreter.
{% if (flag?(:linux) && !flag?(:interpreted)) || flag?(:bsd) %}
{% if (flag?(:linux) && !flag?(:musl) && !flag?(:interpreted)) || flag?(:bsd) %}
@[Link("m")]
{% end %}

Expand Down

0 comments on commit 2d4c35f

Please sign in to comment.