home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.aix
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!unixhub!courant.SLAC.Stanford.EDU!alhy
- From: alhy@courant.SLAC.Stanford.EDU (J. Scott Berg)
- Subject: Shared libraries: the -bM: option to ld
- Message-ID: <C00Bnq.29q@unixhub.SLAC.Stanford.EDU>
- Sender: news@unixhub.SLAC.Stanford.EDU
- Reply-To: ALHY@slac.stanford.edu
- Organization: Stanford University, dept of Physics / SLAC
- Date: Tue, 29 Dec 1992 06:07:01 GMT
- Lines: 82
-
- Can somebody give a detailed explanation of the -bM: option to ld? I
- wanted to have a shared object that had a static (file-scope) variable
- such that
-
- main() calls shrf(5) and objf(3);
- objf(x) calls shrf(x)
-
- shrf() is in the shared object, as is the variable x. shrf() sets the
- variable x to the argument. The desired effect is that objf() and
- shrf() are setting different memory locations. If I link both objf
- and shrf as -bM:S1L, what I find is that in fact both are referencing
- the same variable.
-
- Now, I tried a two-step integration on objf: The first step loaded
- shrf and objf, didn't load the c libraries, and had the options
-
- -berok -bnso -bM:1L
-
- Now, if I do this, the behavior is completely determined (as far as I
- can tell) by what my -bM: option is on the second step of the link
- (where I link in the c libraries): If it's shared (1L or RE), the
- desired behavior occurs. If it's not shared (again, either 1L or RE),
- the desired behavior doesn't occur (both calls reference the same
- memory location). This seems to be independent of the -bM: option
- that I compile with!!!
-
- So, can anybody explain to me what's going on? Enclosed is the
- tarred/compressed/uuencoded set of files that I ran the test with.
- Thanks
-
- -Scott Berg
-
- begin 444 test.tar.Z
- M'YV03<*L*6,F#9LR`!(J7,BPH<.'$"-*G$@10`P8,&S0H`$"`,89,&+8Z(A1
- M!@P9-TAB7!D2XT@8-6;$N'%#HXT8,D"$E!%CA@T`.BL*'4JTJ%$`=>;0"2/'
- M(XPP;-#D.?I0#ANJ$%EB5,FR(]:O8,.*'7MTB!$F08Y,`=$#1(LD+A0H@,H&
- MA`X09?"4&9-S#AHY,5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- M#3#53CU6N/^\NZE7$:V5T<.O;W]$@*_KQK_1ZIN_WR@`G+[N1\`"&O"`T!N1
- MQQ`H*)>(#GN(.MGV@L<2&?`$?*T;W^MH%@/TR4!]#)Q(^T;U/J'%[W?SH^#1
- M0EC`J2F+6+FBPZYZ=2P7-JU9KH%-#87UPJK]Z%GYJ]>]L+4V$*!K86=;V]P8
- MYK#**8!B8RO;P0@6P+()3F`(`]@2Z]9$O#U1>2P,HQC'*)$1>8Z,UC-4]B2X
- M*!6JCB.L@QE-:)`3V<4$A&1DR`AU5RH3HBJ%P,MC](2(/(3%`(R"3*0B%\E(
- MK#@KD6D<701-U\;48>11&)2C#;:"*?3E+"B-1(I2?$;"/O;NA&,!7B!#2;P@
- M[L]>:*.#_Z3HMWL)4%ZLS*4N=]F\$<D*#GF,)`1+=Y()6A(&/LED32Y2@QK0
- MS"3>PZ,B]P@T^/VQ*RJL'R\O-X(0N.`%IZF2?J#URD*V"Y';3*<ZU\G.=KKS
- MG?",ISSG2<]ZVO.>^,RG/O?)SW[Z\Y\`#:A`!TK0@AKTH`A-J$(7RM"&.O2A
- M$(VH1"=*T8I:]*(8S:A&-\K1CGKTHR`-J4A'2M*2FO2D*$VI2E?*TI:Z]*4P
- MC:E,9TK3FMKTICC-J4YWRM.>^O2G0`VJ4(=*U*(:]:A(3:I2E\K4ICKUJ5"-
- LJE2G2M6J6O6J6,VJ5K?*U:YZ]:M@#:M8QTK6LIKUK&A-JUK7RM:VNO6M2`.-
- `
- end
-
-
-
- --
- -------------------------------------------------------------------------------
- The opinions expressed here are, of course, my own and nobody else's.
- -------------------------------------------------------------------------------
- J. Scott Berg
- email: ALHY@slac.stanford.edu
- real mail: Varian Physics
- Stanford CA 94305-4060
- phone: (415) 926-4732 (w)
- (415) 326-2631 (h)
- -------------------------------------------------------------------------------
-
-