Last Comment Bug 217501 - Use sane libpath in NSPR libraries
: Use sane libpath in NSPR libraries
Status: RESOLVED FIXED
:
Product: NSPR
Classification: Components
Component: NSPR (show other bugs)
: other
: Other AIX
: -- normal (vote)
: 4.4.1
Assigned To: Wan-Teh Chang
: Wan-Teh Chang
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2003-08-27 15:10 PDT by Philip K. Warren
Modified: 2003-08-29 17:20 PDT (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Patch v1 (647 bytes, patch)
2003-08-27 15:10 PDT, Philip K. Warren
wtc: review+
asa: approval1.5+
Details | Diff | Splinter Review

Description Philip K. Warren 2003-08-27 15:10:16 PDT
NSPR does not currently set the libpath when creating libraries, and so it often
looks like the following:

pkw@ut:/usr/mozilla/base/ > dump -H libplc4.so

libplc4.so:

                        ***Loader Section***
                      Loader Header Information
VERSION#         #SYMtableENT     #RELOCent        LENidSTR
0x00000001       0x00000036       0x000000b5       0x0000006c       

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
0x00000004       0x00000dac       0x000002ca       0x00000e18       


                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER              
0      /home/pkw/sb/moz14/src/nsmoz/mozilla/dist/lib:/usr/lib:/lib             
                           
1                                    libnspr4.so                             
2                                    libc_r.a            shr.o               
3                                    librtl.a            shr.o

This means that if LIBPATH is not set, the libplc4.so library will look by
default in /home/pkw/sb/moz14/src/nsmoz/mozilla/dist/lib for the libraries
libnspr4.so, libc_r.a, and librtl.a. All NSPR libraries should be created with
the standard AIX libpath (/usr/lib:/lib) and applications should manually set
the LIBPATH variable if they would like to look for libraries in non standard
locations.
Comment 1 Philip K. Warren 2003-08-27 15:10:54 PDT
Created attachment 130488 [details] [diff] [review]
Patch v1
Comment 2 Wan-Teh Chang 2003-08-27 16:33:32 PDT
Comment on attachment 130488 [details] [diff] [review]
Patch v1

r=wtc.

Is there a way to tell the linker to use the standard AIX libpath?

Will the standard AIX libpath (/usr/lib:/lib) ever change?
Comment 3 Wan-Teh Chang 2003-08-27 16:35:08 PDT
If you need this in Mozilla 1.5 Beta, could you request drivers'
approval?
Comment 4 Wan-Teh Chang 2003-08-27 16:42:22 PDT
It seems that the directory that we pass to the -L linker flag at build time
is added to the beginning of the libpath unless the -blibpath flag is used,
correct?
Comment 5 Philip K. Warren 2003-08-28 09:57:07 PDT
Some answers to your questions:

1) Is there a way to tell the linker to use the standard AIX libpath?

It is possible to use the -bnolibpath option to the linker:

nolibpath
Overrides any previous library path generated by the -L flag or specified by the
libpath option. Instead, the default library path information is written in the
loader section of the output file. The default library path information is the
value of the LIBPATH environment variable if it is defined, and /usr/lib:/lib
otherwise.

The reason I did not use this is if someone has set the LIBPATH variable, then
Mozilla will use that as the libpath in all of the shared libraries/binaries it
creates. I felt it was safer to manually specify the libpath.

2) Will the standard AIX libpath (/usr/lib:/lib) ever change?

I asked an expert on AIX linking/loading and this was his comment:

"I can't imagine why it would.  What you're seeing more of now is symlinks in
/usr/lib that point to other places.  So much depends upon that, I could not
imagine making a change...."

3) It seems that the directory that we pass to the -L linker flag at build time
is added to the beginning of the libpath unless the -blibpath flag is used, correct?

This is true - from the ld documentation:

-LDirectory
Adds Directory to the list of search directories used for finding libraries
designated by the -l (lowercase letter L) flag. The list of directories,
including the standard library directories, is also recorded in the output
object file loader section for use by the system loader unless you use the
-blibpath or -bnolibpath option. You can repeat this flag.

For more information, see the ld documentation here:
http://publib16.boulder.ibm.com/doc_link/en_US/a_doc_lib/cmds/aixcmds3/ld.htm
Comment 6 Philip K. Warren 2003-08-28 12:07:03 PDT
Comment on attachment 130488 [details] [diff] [review]
Patch v1

Requesting drivers approval for Mozilla 1.5. This is a low risk, AIX only
patch.
Comment 7 Asa Dotzler [:asa] 2003-08-29 09:45:00 PDT
Comment on attachment 130488 [details] [diff] [review]
Patch v1

a=asa (on behalf of drivers) for checkin to Mozilla 1.5
Comment 8 Wan-Teh Chang 2003-08-29 17:20:30 PDT
Fix checked into the NSPR tip and NSPRPUB_PRE_4_2_CLIENT_BRANCH (Mozilla 1.5).

Note You need to log in before you can comment on or make changes to this bug.