Compiling with Sun compilers from SC5.0 onward.

Steve Langasek vorlon at
Wed Apr 11 01:49:56 GMT 2001

On 10 Apr 2001, Alexandre Oliva wrote:

> On Apr 10, 2001, Jeremy Allison <jeremy at> wrote:

> > Would it work to change the order of the pic tests to
> > -KPIC then -Kpic?

> Most likely.

> > What effect would this have on other platforms ?

> It would prevent the few optimizations that can be obtained with -Kpic
> over -KPIC.  Basically, lower-case pic often means ``assume the
> library fits into some platform-specific size limitations.''  Such
> limitations are often related with the number of entries in the Global
> Offset Table.  Using lower-case PIC often tells the compiler it's safe
> to assume an offset within the GOT fits in the immediate operand of a
> move instruction, or in the displacement of a register+offset
> addressing mode.  If such assumptions can't be made, the compiler must
> assume the offset may not fit, and generate larger instruction
> sequences.

> So, using upper-case -[fK]PIC is always safe, but it will often
> generate bigger and less efficient code.

Indeed. If we're running into problems with -Kpic not working because of
problems with table sizes, it probably makes sense to prefer both -KPIC and
-fPIC over the lower-case equivalents; there's no way to know when -fpic will
stop working on some platforms as well, or whether this may have already

Steve Langasek
postmodern programmer

More information about the samba-technical mailing list