Re: [Boost-bugs] [Boost C++ Libraries] #1186: Lack of 64-bit address model support using Sun Studio C++

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #1186: Lack of 64-bit address model support using Sun Studio C++
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2007-08-24 20:08:21


#1186: Lack of 64-bit address model support using Sun Studio C++
--------------------------------------+-------------------------------------
  Reporter: Simon.Atanasyan_at_[hidden] | Owner: vladimir_prus
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: build
   Version: Boost 1.34.1 | Severity: Problem
Resolution: | Keywords:
--------------------------------------+-------------------------------------
Comment (by stephen.clamage_at_[hidden]):

 Here's the story on -Kpic and -KPIC:

 On x86/x64, there is no difference between -KPIC and -Kpic.[[BR]]
 On sparc, -Kpic is slightly more efficient, but the difference is not
 always enough to notice.

 You compile for position-independent code (-Kpic or -KPIC) usually only
 when building a shared library.

 The difference on sparc is in the instructions used to access the symbol
 via the offset in the Global Offset Table (GOT) in the shared library. The
 -Kpic option causes the compiler to generate a single instruction with 13
 bits for the offset value. The -KPIC option uses two instructions to get a
 32-bit offset.

 You compile a file with -Kpic when you know it will be used in a shared
 library with a modest number of global symbols (references or
 definitions).

 When building your own shared library, you can try building with -Kpic. If
 it links, you are done. A shared library built with -Kpic can be linked to
 a program with a large number of global symbols, because uses of the
 symbol offsets in the shared library are confined to the library itself.

 If you build a "loose" .o file or an archive (.a) to be used by other
 people in their own shared libraries, it is safest to use -KPIC. That
 allows the files to be linked into a big shared library.

 You can mix -Kpic and -KPIC code in the same shared library, as long as
 the -Kpic code doesn't need an offset taking more than 13 bits. In other
 words, a client who used -Kpic can still use your -KPIC binaries in the
 client library.

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1186#comment:6>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.


This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:56 UTC