[PATCH] D13960: [ELF2] Symbol Versioning: part 1, VERSION() directive parsing

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 21 15:35:12 PDT 2015


davide added a comment.

In http://reviews.llvm.org/D13960#272578, @ruiu wrote:

> Does GNU linker accepts both 'global :' and 'global:' as a label? If not, we can handle ':' as part of the name rather than an independent token.


I originally thought about this, but , alas, they do accept both.

% cat version3.script
VERSION {

  VERS_1.1 {
      global :
       x;
  };

}

% /usr/local/bin/ld.bfd -T version3.script
/usr/local/bin/ld.bfd: no input files

% /usr/local/bin/ld.gold -T version3.script
/usr/local/bin/ld.gold: fatal error: no input files

They also support things like:
global:

  global;

for added fun. It looks like for GNU ld "global" is a keyword but they have special cases recognizing "global" (and "local" and "extern") in the yacc grammar.

FWIW, I noticed that GNU gold refuses the example above (but ld.bdf accepts it) and after a conversation with Ian Taylor he agreed this is a gold bug but also pointed out that in some cases there's no right/wrong answer for linker scripts/version scripts because there's no "serious" documentation.


http://reviews.llvm.org/D13960





More information about the llvm-commits mailing list