On 27 Mar 2008, at 20:07, Rod Evans wrote:
> Mark Phalan wrote:
>> Up until recently when I was debugging something I sometimes liked to
>> build debug libraries that I could use with dbx.
>> For e.g. when building mech_krb5.so.1 I built like this:
>> CTFCONVERT_O="" CTFMERGE_LIB="" COPTFLAG="-g" COPTFLAG64="-g" make
>> install
>> I'm not sure exactly what the CTF options are doing but I assume that
>> they are preventing the removal of debug bits that dbx needs.
>> Anyway this stopped working for me recently (I'm on build 84 but  
>> perhaps
>> caused by the direct bindings putback?). When I build with these  
>> options
>> I get plenty of errors:
>> Text relocation remains                         referenced
>>    against symbol                  offset      in file
>> <unknown>                           0x4         pics/gssapi_krb5.o
>> <unknown>                           0xc         pics/gssapi_krb5.o
>> <unknown>                           0x14        pics/gssapi_krb5.o
>> <unknown>                           0x1c        pics/gssapi_krb5.o
>> <unknown>                           0x24        pics/gssapi_krb5.o
>> <unknown>                           0x2c        pics/gssapi_krb5.o
>> oidsets                             0x0         pics/gssapi_krb5.o
>> oidsets                             0x0         pics/gssapi_krb5.o
>> oidsets                             0x0         pics/gssapi_krb5.o
>> ...
>> What's the correct way to build debug libraries (with recent builds)?
>
> I'm not sure I have an answer, but I can replicate the failure  
> you're seeing,
> but don't think it has anything to do with direct bindings.
>
> The "Text relocation" error messages are telling you that the code  
> isn't
> position independent.  These messages are produced by ld(1) when - 
> ztext
> is provided.  As far as I can tell, this flag has always been passed  
> to
> this component (it's actually a default that should be passed to all  
> OSNet
> shard object builds).
>
> Note, even a default build passes in "-g", as debugging information  
> must
> be created for CTF to leverage off of.  So, by default you get:
>
> /ws/onnv-tools/SUNWspro/SS11/bin/cc -O -K pic -xspace -Xa -xildoff \
>                                    ^^
>  -errtags=yes -errwarn=%all -erroff=E_EMPTY_TRANSLATION_UNIT \
>  -erroff=E_STATEMENT_NOT_REACHED -xc99=%none -W0,-xglobalstatic -g ...
>                                                                 ^^
>
> and all is well.   But with your options we get:
>
> /ws/onnv-tools/SUNWspro/SS11/bin/cc -g -K pic -xspace -Xa -xildoff \
>                                     ^^
>   -errtags=yes -errwarn=%all -erroff=E_EMPTY_TRANSLATION_UNIT \
>   -erroff=E_STATEMENT_NOT_REACHED -xc99=%none -W0,-xglobalstatic - 
> g ...
>                                                                  ^^
> and the corresponding text relocation errors.

Thanks for the explanation.

>
>
> The difference is the -O is swapped for -g.  However, the -K pic  
> flag is
> defined for both, so I don't know why the compiler isn't generating
> position independent code.  Perhaps a compiler engineer can  
> enlighten us.
>
> Maybe your debugging requirement can be obtained by simply using
> CTFCONVERT_O="" CTFMERGE_LIB=""?

I'll give that a go - sounds like it should work for me as '-g' is  
passed in anyway (as you mention above).

Thanks,

-M


Reply via email to