diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-10-14 16:51:11 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-10-14 18:38:24 +0900 |
commit | 96cd73d78f8986db0aaab9368c2ffa6867613a37 (patch) | |
tree | d30652b2bbafc6b2fb3dc63db1f5b4d8a7ec6ab0 /tool/leaked-globals | |
parent | eb79b0319bc9b04067bd9c795f9447dd03615df2 (diff) |
Ignore symbols even in empty shared library
On some platforms, such as FreeBSD and Oracle Linux, symbols defined
in the crt0 setup routine are exported from shared libraries. So
ignore the symbols that would be exported even in an empty shared
library.
Diffstat (limited to 'tool/leaked-globals')
-rwxr-xr-x | tool/leaked-globals | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tool/leaked-globals b/tool/leaked-globals index 367d35ab86..87089ebd81 100755 --- a/tool/leaked-globals +++ b/tool/leaked-globals @@ -11,11 +11,14 @@ until ARGV.empty? platform = $1 when /\A SOEXT=(.+)?/x soext = $1 + when /\A SYMBOLS_IN_EMPTYLIB=(.*)/x + SYMBOLS_IN_EMPTYLIB = $1.split(" ") else break end ARGV.shift end +SYMBOLS_IN_EMPTYLIB ||= nil config = ARGV.shift count = 0 @@ -67,7 +70,6 @@ IO.foreach("|#{NM} #{ARGV.join(' ')}") do |line| next unless n.sub!(/^#{SYMBOL_PREFIX}/o, "") next if n.include?(".") next if !so and n.start_with?("___asan_") - case n; when "_init", "_fini"; next end case n when /\A(?:Init_|InitVM_|pm_|[Oo]nig|dln_|coroutine_)/ next @@ -75,6 +77,8 @@ IO.foreach("|#{NM} #{ARGV.join(' ')}") do |line| next unless so when /\A(?:RUBY_|ruby_|rb_)/ next unless so and /_(threadptr|ec)_/ =~ n + when *SYMBOLS_IN_EMPTYLIB + next end next if REPLACE.include?(n) puts col.fail("leaked") if count.zero? |