0

I'm building an RPM and while building I found following command is used to build one shared object of RPM.

g++ /*some compiler options*/ -O1 -Wl,--version-script abc.map -L<some paths> and the remaining command.

I did not understood the what is the use of "--version-script" option and "abc.map" file in the command. What it does? Follwoing is the content of "abc.map" file.

URE_1{
    global:
       _ZTI*; _ZTS*; # weak RTTI symbols for C++ exceptions
    /*some method names explicitly*/
    local:
     *;
}

I think its related to making availability of symbols in the "shared object" file but I'm not sure.

BSalunke
  • 11,499
  • 8
  • 34
  • 68
  • Read https://www.gnu.org/software/gnulib/manual/html_node/LD-Version-Scripts.html and https://sourceware.org/binutils/docs/ld/VERSION.html about _Linker Version Scripts_. Or see http://stackoverflow.com/questions/435352/limiting-visibility-of-symbols-when-linking-shared-libraries/452955 – FrankH. Mar 03 '14 at 16:29

1 Answers1

1

I think its related to making availability of symbols in the "shared object" file but I'm not sure.

You are right.

See 3.9 VERSION Command:

The linker supports symbol versions when using ELF. Symbol versions are only useful when using shared libraries. The dynamic linker can use symbol versions to select a specific version of a function when it runs a program that may have been linked against an earlier version of the shared library.

Lee Duhem
  • 14,695
  • 3
  • 29
  • 47
  • Yes, an example of this is when Red Hat backports a patch, they will often tag it. Then newer versions of other software will explicitly note they need a certain flagged version. I ran into it with a patched `expat` 1.x. – Aaron D. Marasco Mar 03 '14 at 20:51