Project

General

Profile

Actions

Bug #16934

closed

vm_empty_cc is leaking (or leaked-globals is broken, either)

Added by shyouhei (Shyouhei Urabe) almost 4 years ago. Updated almost 4 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:98650]

Description

Noticed that when compiled using clang, make leaked-globals fails:

$ make -s leaked-globals
        BASERUBY = /usr/bin/ruby --disable=gems
        CC = clang-11 -fdeclspec
        LD = ld
        LDSHARED = clang-11 -fdeclspec -shared
        CFLAGS = -O3 -ggdb3 -Wall -Wextra -Werror=deprecated-declarations -Werror=division-by-zero -Werror=implicit-function-declaration -Werror=implicit-int -Werror=misleading-indentation -Werror=pointer-arith -Werror=shorten-64-to-32 -Werror=write-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Werror=extra-tokens -std=gnu99
        XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -DRUBY_DEVEL=1 -fvisibility=hidden -DRUBY_EXPORT -fPIE -DCANONICALIZATION_FOR_MATHN -I. -I.ext/include/x86_64-linux -I/home/shyouhei/data/src/master/include -I/home/shyouhei/data/src/master -I/home/shyouhei/data/src/master/enc/unicode/12.1.0
        CPPFLAGS =  -DNDEBUG
        DLDFLAGS = -Wl,--compress-debug-sections=zlib -fstack-protector-strong -pie
        SOLIBS = -lz -lpthread -lrt -lrt -lgmp -ldl -lcrypt -lm
        LANG =
        LC_ALL =
        LC_CTYPE =
        MFLAGS = -s
clang version 11.0.0-++20200514091409+d3530e95f1d-1~exp1~20200514072012.1682
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Checking leaked global symbols...leaked
  vm_empty_cc
1 un-prefixed symbol leaked
Makefile:690: recipe for target 'leaked-globals' failed
make: *** [leaked-globals] Error 1

Which is not the case for gcc.

Further investigation shows that while gcc puts that variable in COMMON, clang puts it in BSS.

shyouhei@1639f084f547:~$ nm -gp ~/data/build/ruby\@gcc-10/master\@git/libruby-static.a | fgrep -w vm_empty_cc
                 U vm_empty_cc
0000000000000008 C vm_empty_cc
shyouhei@1639f084f547:~$ nm -gp ~/data/build/ruby\@clang-11/master\@git/libruby-static.a | fgrep -w vm_empty_cc
                 U vm_empty_cc
0000000000000068 B vm_empty_cc
shyouhei@1639f084f547:~$

I am not sure if this is either a bug of gcc or clang or ruby. However I can at least say the situation is unintended.

Actions #1

Updated by nobu (Nobuyoshi Nakada) almost 4 years ago

  • Status changed from Open to Closed

Applied in changeset git|2b7454eb922ccbda065affc92e2e94c7c28b809f.


Update leaked-globals [Bug #16934]

  • match uppercase types which would be global, other than [BDT]
  • ignore RUBY_ prefixed symbols
Actions #2

Updated by nobu (Nobuyoshi Nakada) almost 4 years ago

  • Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN to 2.5: REQUIRED, 2.6: REQUIRED, 2.7: REQUIRED
Actions

Also available in: Atom PDF

Like0
Like0Like0