--- a/ObjectFileLoader.st Tue Feb 10 14:37:17 2009 +0100
+++ b/ObjectFileLoader.st Wed Feb 11 18:05:02 2009 +0100
@@ -2467,59 +2467,59 @@
osType := OperatingSystem getOSType.
osType = #win32 ifTrue:[
- self activityNotification:'generating shared object'.
-
- ParserFlags linkArgs isNil ifTrue:[
- ld := ParserFlags linkCommand , ' ' , baseFileName , '.obj'.
- ld := ld
- , ' /NOPACK /NOLOGO /DEBUG /MACHINE:I386 /DLL'
- , ' /OUT:' , baseFileName , '.dll '
+ self activityNotification:'generating shared object'.
+
+ ParserFlags linkArgs isNil ifTrue:[
+ ld := ParserFlags linkCommand , ' ' , baseFileName , '.obj'.
+ ld := ld
+ , ' /NOPACK /NOLOGO /DEBUG /MACHINE:I386 /DLL'
+ , ' /OUT:' , baseFileName , '.dll '
"/ , ' /DEF:' , baseFileName , '.def'.
- ] ifFalse:[
- libDir := '..\libbc'.
- libDir asFilename exists ifFalse:[
- libDir := '..\lib\libbc'.
- libDir asFilename exists ifFalse:[
- libDir := '..\lib'.
- libDir asFilename exists ifFalse:[
- libDir := '..\..\libbc'.
- libDir asFilename exists ifFalse:[
- self error:'could not locate directory where .lib files are'
- ]
- ]
- ]
- ].
-
- ParserFlags useBorlandC ifTrue:[
- ld := ParserFlags linkCommand , ' ' , (ParserFlags linkArgs bindWith:baseFileName).
- ld := ld , ' c0d32.obj ' , baseFileName , '.obj '.
- ld := ld , ',' , baseFileName , '.dll,,',libDir,'\librun.lib '.
- ld := ld , (ParserFlags searchedLibraries asStringCollection asStringWith: $ ).
- ld := ld , ' ',libDir,'\cs32i.lib,,'.
- ] ifFalse:[
- self error:'currently only borlandC is supported'.
- ]
- ].
-
- outfile := (baseFileName , '.out').
-
- ok := OperatingSystem executeCommand:(ld , ' >' , outfile).
- ok ifFalse:[
- output := (baseFileName , '.out') asFilename contentsOfEntireFile.
- Transcript showCR:output; endEntry.
- ].
-
- #('.obj' '.out' '.tds' '.ilc' '.ild'
- '.ilf' '.ils' '.lib' '.map' '.def') do:[:eachSuffix|
- (baseFileName , eachSuffix) asFilename delete.
- ].
-
- ok ifFalse:[
- LastError := output.
- ^ nil
- ].
- oFileName := (Filename currentDirectory construct:(baseFileName , self sharedLibraryExtension)) name.
- ^ oFileName
+ ] ifFalse:[
+ libDir := '..\libbc'.
+ libDir asFilename exists ifFalse:[
+ libDir := '..\lib\libbc'.
+ libDir asFilename exists ifFalse:[
+ libDir := '..\lib'.
+ libDir asFilename exists ifFalse:[
+ libDir := '..\..\libbc'.
+ libDir asFilename exists ifFalse:[
+ self error:'could not locate directory where .lib files are'
+ ]
+ ]
+ ]
+ ].
+
+ ParserFlags useBorlandC ifTrue:[
+ ld := ParserFlags linkCommand , ' ' , (ParserFlags linkArgs bindWith:baseFileName).
+ ld := ld , ' c0d32.obj ' , baseFileName , '.obj '.
+ ld := ld , ',' , baseFileName , '.dll,,',libDir,'\librun.lib '.
+ ld := ld , (ParserFlags searchedLibraries asStringCollection asStringWith: $ ).
+ ld := ld , ' ',libDir,'\cs32i.lib,,'.
+ ] ifFalse:[
+ self error:'currently only borlandC is supported'.
+ ]
+ ].
+
+ outfile := (baseFileName , '.out').
+
+ ok := OperatingSystem executeCommand:(ld , ' >' , outfile).
+ ok ifFalse:[
+ output := (baseFileName , '.out') asFilename contentsOfEntireFile.
+ Transcript showCR:output; endEntry.
+ ].
+
+ #('.obj' '.out' '.tds' '.ilc' '.ild'
+ '.ilf' '.ils' '.lib' '.map' '.def') do:[:eachSuffix|
+ (baseFileName , eachSuffix) asFilename delete.
+ ].
+
+ ok ifFalse:[
+ LastError := output.
+ ^ nil
+ ].
+ oFileName := (Filename currentDirectory construct:(baseFileName , self sharedLibraryExtension)) name.
+ ^ oFileName
].
"/ UNIX systems
@@ -2528,114 +2528,113 @@
needSharedObject := false.
ObjectFileLoader loadableBinaryObjectFormat == #elf ifTrue:[
- "
- link it to a shared object with 'ld -shared'
- "
- needSharedObject := true.
- ldArg := ParserFlags linkSharedArgs ? '-shared'.
+ "
+ link it to a shared object with 'ld -shared'
+ "
+ needSharedObject := true.
+ ldArg := ParserFlags linkSharedArgs ? '-shared'.
].
osType = 'irix' ifTrue:[
- "
- link it to a shared object with 'ld -shared'
- "
- needSharedObject := true.
- ldArg := ParserFlags linkSharedArgs ? '-shared'.
+ "
+ link it to a shared object with 'ld -shared'
+ "
+ needSharedObject := true.
+ ldArg := ParserFlags linkSharedArgs ? '-shared'.
].
osType = 'sys5_4' ifTrue:[
- "
- link it to a shared object with 'ld -G'
- "
- needSharedObject := true.
- ldArg := ParserFlags linkSharedArgs ? '-G'.
+ "
+ link it to a shared object with 'ld -G'
+ "
+ needSharedObject := true.
+ ldArg := ParserFlags linkSharedArgs ? '-G'.
].
osType = 'osf' ifTrue:[
- "
- link it to a shared object with 'ld -shared'
- "
- needSharedObject := true.
- ldArg := ParserFlags linkSharedArgs ? '-shared'.
+ "
+ link it to a shared object with 'ld -shared'
+ "
+ needSharedObject := true.
+ ldArg := ParserFlags linkSharedArgs ? '-shared'.
].
osType = 'solaris' ifTrue:[
- "
- link it to a shared object with 'ld -G -B dynamic'
- "
- needSharedObject := true.
- ldArg := ParserFlags linkSharedArgs ? '-G -Bdynamic'.
+ "
+ link it to a shared object with 'ld -G -B dynamic'
+ "
+ needSharedObject := true.
+ ldArg := ParserFlags linkSharedArgs ? '-G -Bdynamic'.
].
osType = 'hpux' ifTrue:[
- "
- link it to a shared object with 'ld -b -B immediate'
- "
- needSharedObject := true.
- ldArg := ParserFlags linkSharedArgs ? '-b -B immediate'.
+ "
+ link it to a shared object with 'ld -b -B immediate'
+ "
+ needSharedObject := true.
+ ldArg := ParserFlags linkSharedArgs ? '-b -B immediate'.
].
osType = 'aix' ifTrue:[
- self activityNotification:'create export file'.
-
- "/ create an exports file.
- expFileName := './' , baseFileName , '.exp'.
- [
- expFile := expFileName asFilename writeStream.
- expFile nextPutAll:'#!! ./' , baseFileName , (self sharedLibraryExtension).
- expFile cr.
- expFile nextPutAll:'_' , baseFileName , '_Init'.
- expFile close.
- ] on:FileStream openErrorSignal do:[:ex| "do nothing"].
-
- 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 nextPutAll:'#!! ./' , baseFileName , (self sharedLibraryExtension).
+ expFile cr.
+ expFile nextPutAll:'_' , baseFileName , '_Init'.
+ expFile close.
+ ] on:FileStream openErrorSignal do:[:ex| "do nothing"].
+
+ 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 , (self objectFileExtension).
needSharedObject ifTrue:[
- self activityNotification:'generating shared object'.
-
- soFileName := './' , baseFileName , (self sharedLibraryExtension).
- OperatingSystem removeFile:soFileName.
- ld := ld , ' ' , ldArg , ' ',
- (ParserFlags searchedLibraries asStringCollection asStringWith: $ ),
- ' -o ' , soFileName , ' ' , oFileName.
-
- Verbose ifTrue:[
- 'linking with:' errorPrintCR.
- ' ' errorPrint. ld errorPrintCR.
- ].
- ok := OperatingSystem
- executeCommand:(ld , ' >errorOutput 2>&1').
-
- ok ifFalse:[
- output := 'errorOutput' asFilename contentsOfEntireFile.
- Transcript showCR:'linker error message:'.
- Transcript showCR:output.
- Transcript showCR:'linker command:'.
- Transcript showCR:ld; endEntry.
- ].
-
- OperatingSystem removeFile:oFileName.
- expFileName notNil ifTrue:[
- OperatingSystem removeFile:expFileName
- ].
- ^ soFileName.
+ self activityNotification:'generating shared object'.
+
+ soFileName := './' , baseFileName , (self sharedLibraryExtension).
+ OperatingSystem removeFile:soFileName.
+ ld := ld , ' ' , ldArg , ' ',
+ ' -o ' , soFileName , ' ' , oFileName , (ParserFlags searchedLibraries asStringCollection asStringWith: $ ),
+
+ Verbose ifTrue:[
+ 'linking with:' errorPrintCR.
+ ' ' errorPrint. ld errorPrintCR.
+ ].
+ ok := OperatingSystem
+ executeCommand:(ld , ' >errorOutput 2>&1').
+
+ ok ifFalse:[
+ output := 'errorOutput' asFilename contentsOfEntireFile.
+ Transcript showCR:'linker error message:'.
+ Transcript showCR:output.
+ Transcript showCR:'linker command:'.
+ Transcript showCR:ld; endEntry.
+ ].
+
+ OperatingSystem removeFile:oFileName.
+ expFileName notNil ifTrue:[
+ OperatingSystem removeFile:expFileName
+ ].
+ ^ soFileName.
].
"
@@ -4090,7 +4089,7 @@
!ObjectFileLoader class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.269 2008-10-15 15:44:43 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.270 2009-02-11 17:05:02 cg Exp $'
! !
ObjectFileLoader initialize!