--- a/ObjectFileLoader.st Fri Jul 10 18:22:56 1998 +0200
+++ b/ObjectFileLoader.st Wed Jul 15 18:16:18 1998 +0200
@@ -43,6 +43,7 @@
#if defined(hpux10)
# undef SYSV4_DL
# define HPUX10_DL
+# define HAS_DL
#endif
#if defined(alpha) && defined(__osf__)
@@ -281,9 +282,9 @@
NextHandleID := 1.
ObjectMemory addDependent:self.
-"/ OperatingSystem isMSDOSlike ifTrue:[
-"/ "/ ... we'll see
-"/ ].
+"/ OperatingSystem isMSDOSlike ifTrue:[
+"/ "/ ... we'll see
+"/ ].
OperatingSystem isUNIXlike ifTrue:[
systemType := OperatingSystem getOSType.
@@ -397,6 +398,12 @@
SearchedLibraries := aCollectionOfArchivePathNames
!
+verbose
+ "return true, if debug traces are turned on"
+
+ ^ Verbose
+!
+
verbose:aBoolean
"turn on/off debug traces"
@@ -444,6 +451,7 @@
ObjectFileLoader hasValidBinaryExtension:'foo.so'
ObjectFileLoader hasValidBinaryExtension:'foo.dll'
ObjectFileLoader hasValidBinaryExtension:'foo.obj'
+ ObjectFileLoader hasValidBinaryExtension:'foo.sl'
"
"Modified: 29.4.1997 / 21:55:07 / cg"
@@ -495,7 +503,7 @@
"this should return a string to list the namelist of file.
The output of the command should be one line for each symbol,
formatted as:
- addr segment name
+ addr segment name
This is parsed and read by #namesMatching:segment:in:.
If your default nm command cannot produce this, write a little
@@ -507,39 +515,64 @@
os := OperatingSystem getOSType.
(os = 'irix' or:[os = 'osf']) ifTrue:[
- ^ 'nm -B ' , file
+ ^ 'nm -B ' , file
].
(os = 'solaris') ifTrue:[
- ^ 'nm -p ' , file
+ ^ 'nm -p ' , file
].
^ 'nm ' , file
"Modified: / 4.5.1998 / 12:18:47 / cg"
!
-sharedLibraryExtension
- "return the fileName extension used for dynamic loadable objects.
+objectFileExtension
+ "return the fileName extension used for objects,
+ as generated by myself (output of cc).
This is very machine specific."
|os|
OperatingSystem isMSDOSlike ifTrue:[
- "/ includes all of win32s, win95, winNT & os/2
- ^ '.dll'
+ "/ includes all of win32s, win95, winNT & os/2
+ ^ '.obj'
].
OperatingSystem isVMSlike ifTrue:[
- ^ '.exe'
+ ^ '.obj'
+ ].
+
+ ^ '.o'
+
+ "
+ ObjectFileLoader objectFileExtension
+ "
+
+ "Modified: / 4.5.1998 / 12:17:34 / cg"
+!
+
+sharedLibraryExtension
+ "return the fileName extension used for dynamic loadable objects,
+ as generated by myself (output of linker).
+ This is very machine specific."
+
+ |os|
+
+ OperatingSystem isMSDOSlike ifTrue:[
+ "/ includes all of win32s, win95, winNT & os/2
+ ^ '.dll'
+ ].
+ OperatingSystem isVMSlike ifTrue:[
+ ^ '.exe'
].
os := OperatingSystem getSystemType.
(os = 'sys5_4') ifTrue:[^ '.so'].
(os = 'iris') ifTrue:[^ '.so'].
(os = 'linux') ifTrue:[
- self loadableBinaryObjectFormat == #aout ifTrue:[
- "/ not really shared, but loadable
- ^ '.o'
- ].
- ^ '.so'
+ self loadableBinaryObjectFormat == #aout ifTrue:[
+ "/ not really shared, but loadable
+ ^ '.o'
+ ].
+ ^ '.so'
].
(os = 'solaris') ifTrue:[^ '.so' ].
(os = 'osf') ifTrue:[^ '.so' ].
@@ -550,6 +583,10 @@
^ '.o'
+ "
+ ObjectFileLoader sharedLibraryExtension
+ "
+
"Modified: / 4.5.1998 / 12:17:34 / cg"
!
@@ -560,11 +597,11 @@
|os|
OperatingSystem isMSDOSlike ifTrue:[
- "/ includes all of win32s, win95, winNT & os/2
- ^ #('.dll')
+ "/ includes all of win32s, win95, winNT & os/2
+ ^ #('.dll')
].
OperatingSystem isVMSlike ifTrue:[
- ^ #('.exe')
+ ^ #('.exe')
].
os := OperatingSystem getSystemType.
@@ -575,13 +612,13 @@
(os = 'sunos') ifTrue:[^ #('.o' '.obj' '.a') ].
(os = 'ultrix') ifTrue:[^ #('.o' '.obj' '.ld' '.obj.ld') ].
(os = 'linux') ifTrue:[
- self loadableBinaryObjectFormat == #aout ifTrue:[
- ^ #('.o' '.obj' '.a')
- ].
- ^ #('.so' '.o' '.obj' )
+ self loadableBinaryObjectFormat == #aout ifTrue:[
+ ^ #('.o' '.obj' '.a')
+ ].
+ ^ #('.so' '.o' '.obj' )
].
(os = 'aix') ifTrue:[^ #('.o' '.so') ].
- (os = 'hpux') ifTrue:[^ #('.o' '.sl') ].
+ (os = 'hpux') ifTrue:[^ #(" '.o' " '.sl') ].
"/ mhmh what is a useful default ?
@@ -1883,214 +1920,214 @@
saveOldMethodsPerClass|
PreviouslyLoadedObjects notNil ifTrue:[
- PreviouslyLoadedObjects do:[:entry |
- |fileName handle cls sel|
-
- fileName := entry key.
- handle := entry value.
- handle moduleID:nil.
-
- handle isClassLibHandle ifTrue:[
- ('ObjectFileLoader [info]: reloading classes in ' , fileName , ' ...') infoPrintCR.
-
- "/
- "/ remember all byteCode methods (as added in the session)
- "/
- savedByteCodeMethods := Dictionary new.
- savedOldClasses := IdentitySet new.
- saveOldMethodsPerClass := Dictionary new.
-
- handle classes do:[:aClass |
- |clsName mthdDict|
-
- (aClass notNil and:[aClass ~~ 0]) ifTrue:[
- clsName := aClass name.
- mthdDict := aClass methodDictionary.
- saveOldMethodsPerClass at:clsName put:mthdDict copy.
- savedMethods := IdentityDictionary new.
- savedOldClasses add:aClass.
- mthdDict keysAndValuesDo:[:sel :m |
- m byteCode notNil ifTrue:[
- "/ an interpreted method - must be preserved
- savedMethods at:sel put:m
- ]
- ].
- savedMethods notEmpty ifTrue:[
- savedByteCodeMethods at:clsName put:savedMethods
- ].
- ]
- ].
- "/
- "/ load the class binary
- "/
- self loadObjectFile:fileName.
-
- "/ after reloading of the objectFile,
- "/ some of the changes made in the previous life have to be
- "/ redone here - otherwise, we will be left with the
- "/ state contained in the loaded objectModule - instead of
- "/ what we had when saving the image ...
-
- "/
- "/ reinstall the byteCode methods
- "/
- savedByteCodeMethods keysAndValuesDo:[:nm :savedMethods |
- |cls|
-
- cls := Smalltalk classNamed:nm.
- savedMethods keysAndValuesDo:[:sel :m |
- cls primAddSelector:sel withMethod:m.
+ PreviouslyLoadedObjects do:[:entry |
+ |fileName handle cls sel|
+
+ fileName := entry key.
+ handle := entry value.
+ handle moduleID:nil.
+
+ handle isClassLibHandle ifTrue:[
+ ('ObjectFileLoader [info]: reloading classes in ' , fileName , ' ...') infoPrintCR.
+
+ "/
+ "/ remember all byteCode methods (as added in the session)
+ "/
+ savedByteCodeMethods := Dictionary new.
+ savedOldClasses := IdentitySet new.
+ saveOldMethodsPerClass := Dictionary new.
+
+ handle classes do:[:aClass |
+ |clsName mthdDict|
+
+ (aClass notNil and:[aClass ~~ 0]) ifTrue:[
+ clsName := aClass name.
+ mthdDict := aClass methodDictionary.
+ saveOldMethodsPerClass at:clsName put:mthdDict copy.
+ savedMethods := IdentityDictionary new.
+ savedOldClasses add:aClass.
+ mthdDict keysAndValuesDo:[:sel :m |
+ m byteCode notNil ifTrue:[
+ "/ an interpreted method - must be preserved
+ savedMethods at:sel put:m
+ ]
+ ].
+ savedMethods notEmpty ifTrue:[
+ savedByteCodeMethods at:clsName put:savedMethods
+ ].
+ ]
+ ].
+ "/
+ "/ load the class binary
+ "/
+ self loadObjectFile:fileName.
+
+ "/ after reloading of the objectFile,
+ "/ some of the changes made in the previous life have to be
+ "/ redone here - otherwise, we will be left with the
+ "/ state contained in the loaded objectModule - instead of
+ "/ what we had when saving the image ...
+
+ "/
+ "/ reinstall the byteCode methods
+ "/
+ savedByteCodeMethods keysAndValuesDo:[:nm :savedMethods |
+ |cls|
+
+ cls := Smalltalk classNamed:nm.
+ savedMethods keysAndValuesDo:[:sel :m |
+ cls primAddSelector:sel withMethod:m.
"/ ('preserved ' , cls name , '>>' , sel) printCR.
- ]
- ].
-
- "/
- "/ re-remove removed methods
- "/ and re-change method categories
- "/
- savedOldClasses do:[:oldClass |
- |newClass oldMethods newMethodDict oldMthd newMthd
- oldCat oldClassVarString oldClassCategory|
-
- newClass := Smalltalk classNamed:(oldClass name).
- newClass notNil ifTrue:[
- oldClassVarString := oldClass classVariableString.
- newClass classVariableString ~= oldClassVarString ifTrue:[
- "/ there is no need to recreate the variable
- "/ (its in the smalltalk dictionary)
- newClass setClassVariableString:oldClassVarString
- ].
- newClass isMeta ifFalse:[
- oldClassCategory := oldClass category.
- newClass category ~= oldClassCategory ifTrue:[
- newClass category:oldClassCategory
- ]
- ].
- oldMethods := saveOldMethodsPerClass at:oldClass name.
- newMethodDict := newClass methodDictionary.
- newMethodDict keys copy do:[:newSelector |
- (oldMethods includesKey:newSelector) ifFalse:[
+ ]
+ ].
+
+ "/
+ "/ re-remove removed methods
+ "/ and re-change method categories
+ "/
+ savedOldClasses do:[:oldClass |
+ |newClass oldMethods newMethodDict oldMthd newMthd
+ oldCat oldClassVarString oldClassCategory|
+
+ newClass := Smalltalk classNamed:(oldClass name).
+ newClass notNil ifTrue:[
+ oldClassVarString := oldClass classVariableString.
+ newClass classVariableString ~= oldClassVarString ifTrue:[
+ "/ there is no need to recreate the variable
+ "/ (its in the smalltalk dictionary)
+ newClass setClassVariableString:oldClassVarString
+ ].
+ newClass isMeta ifFalse:[
+ oldClassCategory := oldClass category.
+ newClass category ~= oldClassCategory ifTrue:[
+ newClass category:oldClassCategory
+ ]
+ ].
+ oldMethods := saveOldMethodsPerClass at:oldClass name.
+ newMethodDict := newClass methodDictionary.
+ newMethodDict keys copy do:[:newSelector |
+ (oldMethods includesKey:newSelector) ifFalse:[
"/ ('ObjectFileLoader [info]: remove method #' , newSelector , ' from reloaded ' , oldClass name , '.') infoPrintCR.
- newMethodDict removeKey:newSelector
- ] ifTrue:[
- oldMthd := oldMethods at:newSelector.
- newMthd := newMethodDict at:newSelector.
- (oldCat := oldMthd category) ~= newMthd category ifTrue:[
+ newMethodDict removeKey:newSelector
+ ] ifTrue:[
+ oldMthd := oldMethods at:newSelector.
+ newMthd := newMethodDict at:newSelector.
+ (oldCat := oldMthd category) ~= newMthd category ifTrue:[
"/ ('ObjectFileLoader [info]: change category of method #' , newSelector , ' in ' , oldClass name , '.') infoPrintCR.
- newMthd category:oldCat
- ]
- ]
- ]
- ]
- ].
-
- "/
- "/ validate old-classes vs. new classes.
- "/ and if things look ok, get rid of old stuff
- "/ and make instances become instances of the new class
- "/
+ newMthd category:oldCat
+ ]
+ ]
+ ]
+ ]
+ ].
+
+ "/
+ "/ validate old-classes vs. new classes.
+ "/ and if things look ok, get rid of old stuff
+ "/ and make instances become instances of the new class
+ "/
"/ ('ObjectFileLoader [info]: migrating classes ...') infoPrintCR.
- savedOldClasses do:[:oldClass |
- |newClass oldCat oldCVars|
-
- newClass := Smalltalk classNamed:(oldClass name).
- newClass == oldClass ifTrue:[
+ savedOldClasses do:[:oldClass |
+ |newClass oldCat oldCVars|
+
+ newClass := Smalltalk classNamed:(oldClass name).
+ newClass == oldClass ifTrue:[
"/ ('ObjectFileLoader [info]: class ' , oldClass name , ' reloaded.') infoPrintCR.
- ] ifFalse:[
- (newClass isNil or:[newClass == oldClass]) ifTrue:[
- ('ObjectFileLoader [warning]: reload of ' , oldClass name , ' seemed to fail.') errorPrintCR.
- ] ifFalse:[
+ ] ifFalse:[
+ (newClass isNil or:[newClass == oldClass]) ifTrue:[
+ ('ObjectFileLoader [warning]: reload of ' , oldClass name , ' seemed to fail.') errorPrintCR.
+ ] ifFalse:[
"/'oldSize: ' print. oldClass instSize print. ' (' print. oldClass instSize class name print. ') ' print.
"/'newSize: ' print. newClass instSize print. ' (' print. oldClass instSize class name print. ') ' printCR.
- oldClass instSize ~~ newClass instSize ifTrue:[
- ('ObjectFileLoader [warning]: ' , oldClass name , ' has changed its size.') errorPrintCR.
- ] ifFalse:[
- oldClass class instSize ~~ newClass class instSize ifTrue:[
- ('ObjectFileLoader [warning]: ' , oldClass name , ' class has changed its size.') errorPrintCR.
- ] ifFalse:[
+ oldClass instSize ~~ newClass instSize ifTrue:[
+ ('ObjectFileLoader [warning]: ' , oldClass name , ' has changed its size.') errorPrintCR.
+ ] ifFalse:[
+ oldClass class instSize ~~ newClass class instSize ifTrue:[
+ ('ObjectFileLoader [warning]: ' , oldClass name , ' class has changed its size.') errorPrintCR.
+ ] ifFalse:[
"/ ('ObjectFileLoader [info]: migrating ' , oldClass name) infoPrintCR.
- (oldCat := oldClass category) ~= newClass category ifTrue:[
- newClass category:oldCat.
- ].
- (oldCVars := oldClass classVariableString) ~= newClass classVariableString ifTrue:[
- newClass setClassVariableString:oldCVars
- ].
- oldClass becomeSameAs:newClass
+ (oldCat := oldClass category) ~= newClass category ifTrue:[
+ newClass category:oldCat.
+ ].
+ (oldCVars := oldClass classVariableString) ~= newClass classVariableString ifTrue:[
+ newClass setClassVariableString:oldCVars
+ ].
+ oldClass becomeSameAs:newClass
"/ oldClass become:newClass
- ]
- ]
- ]
- ]
- ]
-
- ] ifFalse:[
- handle isMethodHandle ifTrue:[
- oldDummyMethod := handle method.
- (oldDummyMethod isKindOf:Method) ifFalse:[
- ('ObjectFileLoader [info]: ignore obsolete (already collected) method in ' , fileName) infoPrintCR
- ] ifTrue:[
- ('ObjectFileLoader [info]: reloading method in ' , fileName , ' ...') infoPrintCR.
- who := oldDummyMethod who.
- newHandle := self loadMethodObjectFile:fileName.
- newHandle isNil ifTrue:[
- ('ObjectFileLoader [warning]: failed to reload method in ' , fileName , ' ...') errorPrintCR.
- handle moduleID:nil.
- ] ifFalse:[
- m := newHandle method.
- oldDummyMethod sourceFilename notNil ifTrue:[
- m sourceFilename:(oldDummyMethod sourceFilename)
- position:(oldDummyMethod sourcePosition).
- ] ifFalse:[
- m source:(oldDummyMethod source).
- ].
- m package:(oldDummyMethod package).
- who notNil ifTrue:[
- cls := who methodClass.
- sel := who methodSelector.
- m == (cls compiledMethodAt:sel) ifFalse:[
- 'ObjectFileLoader [warning]: oops - loaded method installed wrong' errorPrintCR.
- ] ifTrue:[
+ ]
+ ]
+ ]
+ ]
+ ]
+
+ ] ifFalse:[
+ handle isMethodHandle ifTrue:[
+ oldDummyMethod := handle method.
+ (oldDummyMethod isKindOf:Method) ifFalse:[
+ ('ObjectFileLoader [info]: ignore obsolete (already collected) method in ' , fileName) infoPrintCR
+ ] ifTrue:[
+ ('ObjectFileLoader [info]: reloading method in ' , fileName , ' ...') infoPrintCR.
+ who := oldDummyMethod who.
+ newHandle := self loadMethodObjectFile:fileName.
+ newHandle isNil ifTrue:[
+ ('ObjectFileLoader [warning]: failed to reload method in ' , fileName , ' ...') errorPrintCR.
+ handle moduleID:nil.
+ ] ifFalse:[
+ m := newHandle method.
+ oldDummyMethod sourceFilename notNil ifTrue:[
+ m sourceFilename:(oldDummyMethod sourceFilename)
+ position:(oldDummyMethod sourcePosition).
+ ] ifFalse:[
+ m source:(oldDummyMethod source).
+ ].
+ m package:(oldDummyMethod package).
+ who notNil ifTrue:[
+ cls := who methodClass.
+ sel := who methodSelector.
+ m == (cls compiledMethodAt:sel) ifFalse:[
+ 'ObjectFileLoader [warning]: oops - loaded method installed wrong' errorPrintCR.
+ ] ifTrue:[
"/ cls changed:#methodDictionary with:(Array with:sel with:oldDummyMethod).
- ]
- ].
- ]
- ]
- ] ifFalse:[
- handle isFunctionObjectHandle ifTrue:[
- functions := handle functions.
- functions isEmpty ifTrue:[
- ('ObjectFileLoader [info]: ignore obsolete (unreferenced) functions in ' , fileName) infoPrintCR
- ] ifFalse:[
- newHandle := self loadDynamicObject:fileName.
- newHandle isNil ifTrue:[
- ('ObjectFileLoader [warning]: failed to reload ' , fileName , ' ...') errorPrintCR.
- handle moduleID:nil.
- ] ifFalse:[
- ('ObjectFileLoader [info]: reloading ' , fileName , ' ...') infoPrintCR.
- functions do:[:oldFunction |
- newFunction := newHandle getFunction:(oldFunction name).
- newFunction isNil ifTrue:[
- ('ObjectFileLoader [info]: function: ''' , oldFunction name , ''' no longer present.') errorPrintCR.
- oldFunction code:nil.
- oldFunction setName:oldFunction name moduleHandle:nil.
- ] ifFalse:[
- oldFunction code:(newFunction code).
- oldFunction setName:oldFunction name moduleHandle:newHandle.
- ('ObjectFileLoader [info]: rebound function: ''' , oldFunction name , '''.') infoPrintCR.
- ]
- ].
- handle becomeSameAs:newHandle. "/ the old handle is now void
- ]
- ]
- ] ifFalse:[
- ('ObjectFileLoader [info]: ignored invalid (obsolete) objectFile handle: ' , handle printString) infoPrintCR.
- ]
- ]
- ]
- ].
- PreviouslyLoadedObjects := nil
+ ]
+ ].
+ ]
+ ]
+ ] ifFalse:[
+ handle isFunctionObjectHandle ifTrue:[
+ functions := handle functions.
+ functions isEmpty ifTrue:[
+ ('ObjectFileLoader [info]: ignore obsolete (unreferenced) functions in ' , fileName) infoPrintCR
+ ] ifFalse:[
+ newHandle := self loadDynamicObject:fileName.
+ newHandle isNil ifTrue:[
+ ('ObjectFileLoader [warning]: failed to reload ' , fileName , ' ...') errorPrintCR.
+ handle moduleID:nil.
+ ] ifFalse:[
+ ('ObjectFileLoader [info]: reloading ' , fileName , ' ...') infoPrintCR.
+ functions do:[:oldFunction |
+ newFunction := newHandle getFunction:(oldFunction name).
+ newFunction isNil ifTrue:[
+ ('ObjectFileLoader [info]: function: ''' , oldFunction name , ''' no longer present.') errorPrintCR.
+ oldFunction code:nil.
+ oldFunction setName:oldFunction name moduleHandle:nil.
+ ] ifFalse:[
+ oldFunction code:(newFunction code).
+ oldFunction setName:oldFunction name moduleHandle:newHandle.
+ ('ObjectFileLoader [info]: rebound function: ''' , oldFunction name , '''.') infoPrintCR.
+ ]
+ ].
+ handle becomeSameAs:newHandle. "/ the old handle is now void
+ ]
+ ]
+ ] ifFalse:[
+ ('ObjectFileLoader [info]: ignored invalid (obsolete) objectFile handle: ' , handle printString) infoPrintCR.
+ ]
+ ]
+ ]
+ ].
+ PreviouslyLoadedObjects := nil
]
"Modified: / 16.5.1998 / 14:23:12 / cg"
@@ -2103,29 +2140,29 @@
were loaded in the previous life"
LoadedObjects notNil ifTrue:[
- PreviouslyLoadedObjects := OrderedCollection new.
- LoadedObjects keysAndValuesDo:[:name :handle |
- handle isForCollectedObject ifTrue:[
- ('ObjectFileLoader [info]: ignore object for already collected objects in ' , name) infoPrintCR
- ] ifFalse:[
- PreviouslyLoadedObjects add:(name -> handle)
- ]
- ].
- PreviouslyLoadedObjects sort:[:a :b |
- |h1 h2|
-
- h1 := a value moduleID.
- h2 := b value moduleID.
- h1 isNil
- ifTrue:[true]
- ifFalse:[
- h2 isNil
- ifTrue:[false]
- ifFalse:[
- h1 < h2
- ]
- ]
- ].
+ PreviouslyLoadedObjects := OrderedCollection new.
+ LoadedObjects keysAndValuesDo:[:name :handle |
+ handle isForCollectedObject ifTrue:[
+ ('ObjectFileLoader [info]: ignore object for already collected objects in ' , name) infoPrintCR
+ ] ifFalse:[
+ PreviouslyLoadedObjects add:(name -> handle)
+ ]
+ ].
+ PreviouslyLoadedObjects sort:[:a :b |
+ |h1 h2|
+
+ h1 := a value moduleID.
+ h2 := b value moduleID.
+ h1 isNil
+ ifTrue:[true]
+ ifFalse:[
+ h2 isNil
+ ifTrue:[false]
+ ifFalse:[
+ h1 < h2
+ ]
+ ]
+ ].
]
"Created: 5.12.1995 / 20:51:07 / cg"
@@ -2201,100 +2238,108 @@
osType := OperatingSystem getOSType.
osType = 'irix' ifTrue:[
- "
- link it to a shared object with 'ld -shared'
- "
- needSharedObject := true.
- ldArg := '-shared'.
+ "
+ link it to a shared object with 'ld -shared'
+ "
+ needSharedObject := true.
+ ldArg := '-shared'.
].
osType = 'sys5_4' ifTrue:[
- "
- link it to a shared object with 'ld -G'
- "
- needSharedObject := true.
- ldArg := '-G'.
+ "
+ link it to a shared object with 'ld -G'
+ "
+ needSharedObject := true.
+ ldArg := '-G'.
].
osType = 'osf' ifTrue:[
- "
- link it to a shared object with 'ld -shared'
- "
- needSharedObject := true.
- ldArg := '-shared'.
+ "
+ link it to a shared object with 'ld -shared'
+ "
+ needSharedObject := true.
+ ldArg := '-shared'.
].
osType = 'linux' ifTrue:[
- ObjectFileLoader loadableBinaryObjectFormat == #elf ifTrue:[
- "
- link it to a shared object with 'ld -shared'
- "
- needSharedObject := true.
- ldArg := '-shared'.
- ]
+ ObjectFileLoader loadableBinaryObjectFormat == #elf ifTrue:[
+ "
+ link it to a shared object with 'ld -shared'
+ "
+ needSharedObject := true.
+ ldArg := '-shared'.
+ ]
].
osType = 'solaris' ifTrue:[
- "
- link it to a shared object with 'ld -G -B dynamic'
- "
- needSharedObject := true.
- ldArg := '-G -B dynamic'.
+ "
+ link it to a shared object with 'ld -G -B dynamic'
+ "
+ needSharedObject := true.
+ ldArg := '-G -B dynamic'.
+ ].
+
+ osType = 'hpux' ifTrue:[
+ "
+ link it to a shared object with 'ld -b -B immediate'
+ "
+ needSharedObject := true.
+ ldArg := '-b -B immediate'.
].
osType = 'aix' ifTrue:[
- self activityNotification:'create export file'.
-
- "/ create an exports file.
- expFileName := './' , baseFileName , '.exp'.
-
- expFile := expFileName asFilename writeStream.
- expFile notNil ifTrue:[
- expFile nextPutAll:'#!! ./' , baseFileName , '.so'.
- expFile cr.
- expFile nextPutAll:'_' , baseFileName , '_Init'.
- expFile close.
- ].
-
- self activityNotification:'generating shared object'.
-
- "
- link it to a shared object with 'cc -bI:...librun.exp -bE -bMSRE'
- "
- needSharedObject := true.
- ld := 'cc'.
- librunExpFileName := Smalltalk getSystemFileName:'lib/librun_aix.exp'.
- librunExpFileName isNil ifTrue:[
- LastError := 'missing exports file: ''lib/librun_aix.exp'' - cannot link'.
- ^ nil
- ].
-
- ldArg := '-bI:' , librunExpFileName ,
- ' -bE:' , baseFileName , '.exp' ,
- ' -bM:SRE -e _' , baseFileName , '_Init'.
+ self activityNotification:'create export file'.
+
+ "/ create an exports file.
+ expFileName := './' , baseFileName , '.exp'.
+
+ expFile := expFileName asFilename writeStream.
+ expFile notNil ifTrue:[
+ expFile nextPutAll:'#!! ./' , baseFileName , (self sharedLibraryExtension).
+ expFile cr.
+ expFile nextPutAll:'_' , baseFileName , '_Init'.
+ expFile close.
+ ].
+
+ self activityNotification:'generating shared object'.
+
+ "
+ link it to a shared object with 'cc -bI:...librun.exp -bE -bMSRE'
+ "
+ needSharedObject := true.
+ ld := 'cc'.
+ librunExpFileName := Smalltalk getSystemFileName:'lib/librun_aix.exp'.
+ librunExpFileName isNil ifTrue:[
+ LastError := 'missing exports file: ''lib/librun_aix.exp'' - cannot link'.
+ ^ nil
+ ].
+
+ ldArg := '-bI:' , librunExpFileName ,
+ ' -bE:' , baseFileName , '.exp' ,
+ ' -bM:SRE -e _' , baseFileName , '_Init'.
].
- oFileName := './' , baseFileName , '.o'.
+ oFileName := './' , baseFileName , (self objectFileExtension).
needSharedObject ifTrue:[
- self activityNotification:'generating shared object'.
-
- soFileName := './' , baseFileName , '.so'.
- OperatingSystem removeFile:soFileName.
- Verbose ifTrue:[
- 'linking with:' infoPrintCR.
- ' ' infoPrint.
- (ld , ' ' , ldArg , ' -o ' , soFileName , ' ' , oFileName) infoPrintCR.
- ].
- OperatingSystem executeCommand:
- ld , ' ' , ldArg , ' ',
- (SearchedLibraries asStringCollection asStringWith: $ ),
- ' -o ' , soFileName , ' ' , oFileName.
-
- OperatingSystem removeFile:oFileName.
- expFileName notNil ifTrue:[
- OperatingSystem removeFile:expFileName
- ].
- ^ soFileName.
+ self activityNotification:'generating shared object'.
+
+ soFileName := './' , baseFileName , (self sharedLibraryExtension).
+ OperatingSystem removeFile:soFileName.
+ Verbose ifTrue:[
+ 'linking with:' infoPrintCR.
+ ' ' infoPrint.
+ (ld , ' ' , ldArg , ' -o ' , soFileName , ' ' , oFileName) infoPrintCR.
+ ].
+ OperatingSystem executeCommand:
+ ld , ' ' , ldArg , ' ',
+ (SearchedLibraries asStringCollection asStringWith: $ ),
+ ' -o ' , soFileName , ' ' , oFileName.
+
+ OperatingSystem removeFile:oFileName.
+ expFileName notNil ifTrue:[
+ OperatingSystem removeFile:expFileName
+ ].
+ ^ soFileName.
].
"
@@ -3469,6 +3514,6 @@
!ObjectFileLoader class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.167 1998-06-15 13:09:56 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.168 1998-07-15 16:16:18 cg Exp $'
! !
ObjectFileLoader initialize!