bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gold/18548] New: gold incorrectly exports start/stop symbols (GLOBA


From: dh.herrmann at gmail dot com
Subject: [Bug gold/18548] New: gold incorrectly exports start/stop symbols (GLOBAL)
Date: Wed, 17 Jun 2015 10:09:43 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=18548

            Bug ID: 18548
           Summary: gold incorrectly exports start/stop symbols (GLOBAL)
           Product: binutils
           Version: 2.25
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gold
          Assignee: ccoutant at gmail dot com
          Reporter: dh.herrmann at gmail dot com
                CC: ian at airs dot com
  Target Milestone: ---

Created attachment 8368
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8368&action=edit
test.c: Example source file

Hi

Currently, gold incorrectly exports __start_SECTION and __stop_SECTION symbols
if they're referenced by some code, even though the version script clearly
marks them as local. This only happens with gold, bfd correctly hides them.

The example source file test.c was compiled via:

    gcc -Wall -fvisibility=hidden -Wl,--version-script=test.sym -shared -fPIC
-Wl,-fuse-ld=gold -o test.so test.c

The symbol file (test.sym) I used is:

    MY_SYMBOLS { local: *; };

If compiled with gold, I see this:

    $ readelf --syms test.so | grep _MY_SECTION
     6: 00000000000019bc     0 NOTYPE  GLOBAL DEFAULT   24 __stop_MY_SECTION
     7: 00000000000019b8     0 NOTYPE  GLOBAL DEFAULT   24 __start_MY_SECTION
    32: 00000000000019bc     0 NOTYPE  GLOBAL DEFAULT   24 __stop_MY_SECTION
    33: 00000000000019b8     0 NOTYPE  GLOBAL DEFAULT   24 __start_MY_SECTION

..even though I expect to see this (as bfd produces):

    $ readelf --syms test.so | grep _MY_SECTION
    41: 00000000002008ec     0 NOTYPE  LOCAL  DEFAULT   23 __stop_MY_SECTION
    46: 00000000002008e8     0 NOTYPE  LOCAL  DEFAULT   23 __start_MY_SECTION

A workaround is to explicitly add

    __attribute__((__visibility__("hidden")))

to the local declaration of the __start_* and __stop_* variables in the C file.
Somehow, gold seems to discard the default visibility option for those symbols.

-- 
You are receiving this mail because:
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]