MantisBT - CMake
View Issue Details
0007873CMakeCMakepublic2008-10-28 12:312016-06-10 14:30
George Neill 
Bill Hoffman 
normalminorN/A
closedmoved 
Sun SPARCSolaris10
CMake-2-6 
 
0007873: sun solaris (sparc) -xcode vs. -KPIC
Sun Studio 12, on SPARC, (possibly back to SS10?) obsoletes the use of the -KPIC when building shared libraries.

<manpage quote>
     -KPIC
          (SPARC) Obsolete. You should not use this option. Use
          -xcode=pic32 instead. For a complete list of obsolete
          options and flags, see the C User's Guide.

          (x86) -KPIC is identical to -Kpic on x86 architectures.

     -Kpic
          (SPARC) Obsolete. You should not use this option. Use
          -xcode=pic13 instead. For a complete list of obsolete
          options and flags, see the C User's Guide.

          (x86) Produces position-independent code. Use this
          option to compile source files when building a shared
          library. Each reference to a global datum is generated
          as a dereference of a pointer in the global offset
          table. Each function call is generated in pc-relative
          addressing mode through a procedure linkage table.
</manpage quote>

and here's the relevent documentation from the manpages about -xcode.

<manpage quote>
     -xcode=v
          (SPARC) Specify code address space

          Note: It is highly recommended that you build shared
          objects by specifying -xcode=pic13 or -xcode=pic32. It
          is possible to build workable shared objects with
          -xarch=v9 -xcode=abs64 and with -xarch=v8 -xcode=abs32,
          but these will be inefficient. Shared objects built
          with -xarch=v9 -xcode=abs32 or -xarch=v9 -xcode=abs44
          will not work.

          The values for -xcode are:

          abs32 This is the default for 32-bit systems. Gen-
                  erates 32-bit absolute addresses.
                  Code + data + bss size is limited to 2**32
                  bytes.

          abs44 This is the default for 64-bit systems. Gen-
                  erates 44-bit absolute addresses.
                  Code + data + bss size is limited to 2**44
                  bytes. Available only on 64-bit architectures.

          abs64 Generates 64-bit absolute addresses.
                  Available only on 64-bit architectures.

          pic13 Generates position-independent code for use in
                  shared libraries (small model).
                  Equivalent to -Kpic. Permits references to at
                  most 2**11 unique external symbols on 32-bit
                  architectures, 2**10 on 64-bit.

          pic32 Generates position-independent code for use in
                  shared libraries (large model).
                  Equivalent to -KPIC. Permits references to at
                  most 2**30 unique external symbols on 32-bit
                  architectures, 2**29 on 64-bit.

          The default is -xcode=abs32 for 32-bit architectures.
          The default is -xcode=abs44 for 64-bit architectures.

          When building shared dynamic libraries, the default
          -xcode value of abs44 (not abs32) will not work with
          64-bit architectures. Specify -xcode=pic13 or
          -xcode=pic32 instead.

          To determine whether to use -xcode=pic13 or
          -xcode=pic32, check the size of the Global Offset Table
          (GOT) by using elfdump -c (see the elfdump(1) man page
          for more information) and to look for the section
          header, sh_name: .got. The sh_size value is the size of
          the GOT. If the GOT is less than 8,192 bytes, specify
          -xcode=pic13, otherwise specify -xcode=pic32.

          In general, use the following guidelines to determine
          how you should use -xcode:

          o If you are building an executable you should not use
          -xcode=pic13 or -xcode=pic32.

          o If you are building an archive library only for
          linking into executables you should not use
          -xcode=pic13 or -xcode=pic32.

          o If you are building a shared library, start with
          -xcode=pic13 and once the GOT size exceeds 8,192 bytes,
          use -xcode=pic32.

          o If you are building an archive library for linking
          into shared libraries you should just use -xcode=pic32.
</manpage quote>
It appears the -KPIC flag is still accepted by the compiler, so I have set this bug as minor severity.
No tags attached.
Issue History
2008-10-28 12:31George NeillNew Issue
2009-01-07 14:34Bill HoffmanStatusnew => assigned
2009-01-07 14:34Bill HoffmanAssigned To => Bill Hoffman
2013-11-02 10:18Stephen KellyNote Added: 0034322
2016-06-10 14:27Kitware RobotNote Added: 0041461
2016-06-10 14:27Kitware RobotStatusassigned => resolved
2016-06-10 14:27Kitware RobotResolutionopen => moved
2016-06-10 14:30Kitware RobotStatusresolved => closed

Notes
(0034322)
Stephen Kelly   
2013-11-02 10:18   
We have

 set(CMAKE_CXX_COMPILE_OPTIONS_PIC -KPIC)
 set(CMAKE_CXX_COMPILE_OPTIONS_PIE -KPIE)

Is -KPIE also obsolete?
(0041461)
Kitware Robot   
2016-06-10 14:27   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.