View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014010CMakeCMakepublic2013-03-13 12:562013-10-07 10:04
ReporterKevin Burge 
Assigned ToBrad King 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformPowerOSAIXOS Version6.1
Product VersionCMake 2.8.10.2 
Target VersionCMake 2.8.11Fixed in VersionCMake 2.8.11 
Summary0014010: IBM XL: Shared library object files not being compiled as position independent code
DescriptionIt looks like the AIX XL module is missing:

set(CMAKE_C_COMPILE_OPTIONS_PIC "-qpic")
set(CMAKE_CXX_COMPILE_OPTIONS_PIC "-qpic")

Which is required for compiling position independent code.

I'm not sure if CMAKE_C_COMPILE_OPTIONS_PIE needs to be set as well.

I believe this to be the real issue behind the bug I reported as 0013997.

Example from the documentation:

To compile a shared library libmylib.so, use the following commands:
xlc mylib.c -qpic=small -c -o mylib.o
xlc -qmkshrobj mylib -o libmylib.so.1
TagsNo tags attached.
Attached Files

 Relationships
related to 0013997closedBrad King AIX shared library creation has redundant -brtl flag 

  Notes
(0032608)
Brad King (manager)
2013-03-13 13:20

According to the xlc man page -qpic is the default:

 -qpic[={small|large}] | -qnopic
  ...
  Default: -qpic=small
(0032609)
Kevin Burge (reporter)
2013-03-13 13:32

Are you sure that doesn't just mean that the default for -qpic is -qpic=small? Otherwise, what would be the point of the option if ALL object files were created with pic?
(0032611)
Brad King (manager)
2013-03-13 13:48

Actually here is some documentation that says the default is platform dependent:

 http://publib.boulder.ibm.com/infocenter/compbgpl/v9v111/index.jsp?topic=/com.ibm.xlcpp9.bg.doc/compiler_ref/opt_pic.htm [^]

 Defaults
    -qnopic in 32-bit compilation mode.
    -qpic=small in 64-bit compilation mode.
    -qpic=small when the -qmkshrobj compiler option is specified.
 Specifying -qpic without any suboptions is equivalent to -qpic=small.
 When -q64 is in effect, -qpic is enabled and cannot be disabled.

The xlc man page must be platform-specific or simply incorrect.
(0032612)
Brad King (manager)
2013-03-13 13:51

Please try out CMake from the 'next' branch:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5c8c1d62 [^]
(0032613)
Kevin Burge (reporter)
2013-03-13 14:11

Brad, thanks for looking into this. I admit that it looks like you are correct. If I run /usr/vacpp/bin/xlc, it in fact does show:

       -qpic[={small|large}] | -qnopic
                Generates position-independent code (pic). Specify
                -qpic=small if the Global Offset Table in 32-bit
                mode or Table of Contents in 64-bit mode must be 64
                Kb or smaller, or -qpic=large if it can be larger
                than 64 Kb.

                Default: -qpic=small

But, using this very same vacpp, when I try:

/usr/vacpp/bin/xlc -qnopic mytest.c -c -o mytest.o
1506-173 (W) Option -qnopic is not valid. Enter xlc for list of valid options.

So, that does throw the documentation into question a bit. You can close this. We'll just do whatever we need to do.
(0032614)
Brad King (manager)
2013-03-13 14:21

Re 0014010:0032613: The reason -qnopic does not work is probably due to the "When -q64 is in effect, -qpic is enabled and cannot be disabled" rule in the documentation linked in 0014010:0032611.

Does the patch in 0014010:0032612 solve this for you?
(0032615)
Kevin Burge (reporter)
2013-03-13 14:42

I tried -qnopic with and without -q32. I has the same warning.

We're trying your change, but with -qpic=large. We also added the -qpic=large to the shared library create flags, since you need it there also if you are explicitly stating the value (small|large).

It will be hours before the build will complete. I'll follow up later.
(0032616)
Brad King (manager)
2013-03-13 15:16

Thanks for testing. For reference, here is documentation of -qpic as of XL C/C++ V8.0 for AIX:

 http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8a.doc%2Fcompiler%2Fref%2Fruoptpic.htm [^]
 If -qpic is specified without any suboptions, -qpic=small is assumed.
 The -qpic option is implied if either the -G or -qmkshrobj compiler option is specified.
 Specifying -qpic=large has the same effect as passing -bbigtoc to ld.
(0032617)
Kevin Burge (reporter)
2013-03-13 15:24

We're using XLC 11.1.
(0032632)
Brad King (manager)
2013-03-14 13:37

The change in 0014010:0032612 is now in master and will be in 2.8.11.

This resolves the issue as reported. Whether your particular project needs a special value for the flag is a separate discussion.
(0034006)
Robert Maynard (manager)
2013-10-07 10:04

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2013-03-13 12:56 Kevin Burge New Issue
2013-03-13 13:10 Brad King Relationship added related to 0013997
2013-03-13 13:20 Brad King Note Added: 0032608
2013-03-13 13:32 Kevin Burge Note Added: 0032609
2013-03-13 13:48 Brad King Note Added: 0032611
2013-03-13 13:51 Brad King Note Added: 0032612
2013-03-13 13:54 Brad King Summary Shared library object files not being compiled as position independent code => IBM XL: Shared library object files not being compiled as position independent code
2013-03-13 13:55 Brad King Assigned To => Brad King
2013-03-13 13:55 Brad King Status new => assigned
2013-03-13 13:55 Brad King Target Version => CMake 2.8.11
2013-03-13 14:11 Kevin Burge Note Added: 0032613
2013-03-13 14:21 Brad King Note Added: 0032614
2013-03-13 14:42 Kevin Burge Note Added: 0032615
2013-03-13 15:16 Brad King Note Added: 0032616
2013-03-13 15:24 Kevin Burge Note Added: 0032617
2013-03-14 13:37 Brad King Note Added: 0032632
2013-03-14 13:37 Brad King Status assigned => resolved
2013-03-14 13:37 Brad King Resolution open => fixed
2013-03-14 13:37 Brad King Fixed in Version => CMake 2.8.11
2013-10-07 10:04 Robert Maynard Note Added: 0034006
2013-10-07 10:04 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team