ObjectFileLoader.st
changeset 1014 5a62d96fd129
parent 1010 46287addc332
child 1018 011f0c9fa19d
--- a/ObjectFileLoader.st	Thu Dec 23 18:34:01 1999 +0100
+++ b/ObjectFileLoader.st	Thu Dec 23 21:08:47 1999 +0100
@@ -2480,87 +2480,87 @@
     osType := OperatingSystem getOSType.
 
     osType = 'win32' ifTrue:[
-	self activityNotification:'create def file'.
-
-	"/ create a .def file.
-	expFileName := '.\' , baseFileName , '.def'.
-
-	expFile := expFileName asFilename writeStream.
-	expFile notNil ifTrue:[
-	    OperatingSystem getCCDefine ='__BORLANDC__' ifTrue:[
-		expFile nextPutLine:'LIBRARY ' , baseFileName.
-		expFile nextPutLine:'SEGMENTS'.
-		expFile nextPutLine:'    INITCODE PRELOAD SHARED'.
+        self activityNotification:'create def file'.
+
+        "/ create a .def file.
+        expFileName := '.\' , baseFileName , '.def'.
+
+        expFile := expFileName asFilename writeStream.
+        expFile notNil ifTrue:[
+            OperatingSystem getCCDefine ='__BORLANDC__' ifTrue:[
+                expFile nextPutLine:'LIBRARY ' , baseFileName.
+                expFile nextPutLine:'SEGMENTS'.
+                expFile nextPutLine:'    INITCODE PRELOAD SHARED'.
 "/                expFile nextPutLine:'    INITDATA READ WRITE'.
-		expFile nextPutLine:'EXPORTS'.
-		expFile nextPutLine:' __' , baseFileName , '_Init'.
-	    ] ifFalse:[
-		expFile nextPutLine:'LIBRARY ' , baseFileName.
-		expFile nextPutLine:'CODE EXECUTE READ SHARED'.
-		expFile nextPutLine:'DATA READ WRITE'.
-		expFile nextPutLine:'SECTIONS'.
-		expFile nextPutLine:' INITCODE READ EXECUTE SHARED'.
-		expFile nextPutLine:' INITDATA READ WRITE'.
-		expFile nextPutLine:' RODATA READ SHARED'.
-		expFile nextPutLine:'EXPORTS'.
-		expFile nextPutLine:' _' , baseFileName , '_Init'.
-		expFile nextPutLine:'IMPORTS'.
-	    ].
-	    expFile close.
-	].
-
-	self activityNotification:'generating shared object'.
-
-	LinkArgs isNil ifTrue:[
-	    ld := LinkCommand , ' ' , baseFileName , '.obj'.
-	    ld := ld
-	       , ' /NOPACK /NOLOGO /DEBUG /MACHINE:I386 /DLL'
-	       , ' /OUT:' , baseFileName , '.dll '
-	       , ' /DEF:' , baseFileName , '.def'.
-	] ifFalse:[
-	    OperatingSystem getCCDefine ='__BORLANDC__' ifTrue:[
-		ld := LinkCommand , ' ' , (LinkArgs bindWith:baseFileName).
-		ld := ld , ' c0d32.obj ' , baseFileName , '.obj '.
-		ld := ld , ',' , baseFileName , '.dll,,..\libbc\librun.lib '.
-		ld := ld , (SearchedLibraries asStringCollection asStringWith: $ ).
-		ld := ld , ' ..\libbc\stxc32i.lib,,'.
-	    ] ifFalse:[
-		LastError := 'currently only support borlandC'.
-		self halt:'currently only support borlandC'.
-		^ nil
-	    ]
-	].
-
-	outfile := (baseFileName , '.out').
-	OperatingSystem isMSWINDOWSNTlike ifTrue:[
-	    ok := OperatingSystem executeCommand:ld
-	] ifFalse:[
-	    ok := OperatingSystem executeCommand:(ld , ' >' , outfile).
-
-	    ok ifFalse:[
-		output := (baseFileName , '.out') asFilename contents asString.
-		Transcript showCR:output; endEntry.
-	    ]
-	].
-
-	(baseFileName , '.out') asFilename delete.
-	(baseFileName , '.tds') asFilename delete.
-	(baseFileName , '.ilc') asFilename delete.
-	(baseFileName , '.ild') asFilename delete.
-	(baseFileName , '.ilf') asFilename delete.
-	(baseFileName , '.ils') asFilename delete.
-	(baseFileName , '.lib') asFilename delete.
-	(baseFileName , '.map') asFilename delete.
-	(baseFileName , '.def') asFilename delete.
-	(baseFileName , '.obj') asFilename delete.
-
-	ok ifFalse:[
-	    "/ self halt.
-	    LastError := output.
-	    ^ nil
-	].
-	oFileName := (Filename currentDirectory construct:(baseFileName , self sharedLibraryExtension)) name.
-	^ oFileName
+                expFile nextPutLine:'EXPORTS'.
+                expFile nextPutLine:' __' , baseFileName , '_Init'.
+            ] ifFalse:[
+                expFile nextPutLine:'LIBRARY ' , baseFileName.
+                expFile nextPutLine:'CODE EXECUTE READ SHARED'.
+                expFile nextPutLine:'DATA READ WRITE'.
+                expFile nextPutLine:'SECTIONS'.
+                expFile nextPutLine:' INITCODE READ EXECUTE SHARED'.
+                expFile nextPutLine:' INITDATA READ WRITE'.
+                expFile nextPutLine:' RODATA READ SHARED'.
+                expFile nextPutLine:'EXPORTS'.
+                expFile nextPutLine:' _' , baseFileName , '_Init'.
+                expFile nextPutLine:'IMPORTS'.
+            ].
+            expFile close.
+        ].
+
+        self activityNotification:'generating shared object'.
+
+        LinkArgs isNil ifTrue:[
+            ld := LinkCommand , ' ' , baseFileName , '.obj'.
+            ld := ld
+               , ' /NOPACK /NOLOGO /DEBUG /MACHINE:I386 /DLL'
+               , ' /OUT:' , baseFileName , '.dll '
+               , ' /DEF:' , baseFileName , '.def'.
+        ] ifFalse:[
+            OperatingSystem getCCDefine ='__BORLANDC__' ifTrue:[
+                ld := LinkCommand , ' ' , (LinkArgs bindWith:baseFileName).
+                ld := ld , ' c0d32.obj ' , baseFileName , '.obj '.
+                ld := ld , ',' , baseFileName , '.dll,,..\libbc\librun.lib '.
+                ld := ld , (SearchedLibraries asStringCollection asStringWith: $ ).
+                ld := ld , ' ..\libbc\cs32i.lib,,'.
+            ] ifFalse:[
+                LastError := 'currently only support borlandC'.
+                self halt:'currently only support borlandC'.
+                ^ nil
+            ]
+        ].
+
+        outfile := (baseFileName , '.out').
+        OperatingSystem isMSWINDOWSNTlike ifTrue:[
+            ok := OperatingSystem executeCommand:ld
+        ] ifFalse:[
+            ok := OperatingSystem executeCommand:(ld , ' >' , outfile).
+
+            ok ifFalse:[
+                output := (baseFileName , '.out') asFilename contents asString.
+                Transcript showCR:output; endEntry.
+            ]
+        ].
+
+        (baseFileName , '.out') asFilename delete.
+        (baseFileName , '.tds') asFilename delete.
+        (baseFileName , '.ilc') asFilename delete.
+        (baseFileName , '.ild') asFilename delete.
+        (baseFileName , '.ilf') asFilename delete.
+        (baseFileName , '.ils') asFilename delete.
+        (baseFileName , '.lib') asFilename delete.
+        (baseFileName , '.map') asFilename delete.
+        (baseFileName , '.def') asFilename delete.
+        (baseFileName , '.obj') asFilename delete.
+
+        ok ifFalse:[
+            "/ self halt.
+            LastError := output.
+            ^ nil
+        ].
+        oFileName := (Filename currentDirectory construct:(baseFileName , self sharedLibraryExtension)) name.
+        ^ oFileName
     ].
 
     "/ UNIX systems
@@ -2569,116 +2569,116 @@
     needSharedObject := false.
 
     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.
+        "
+         link it to a shared object with 'ld -G -B dynamic'
+        "
+        needSharedObject := true.
 "/        ldArg := '-G -B dynamic'.
-	ldArg := '-G -Bdynamic'.
+        ldArg := '-G -Bdynamic'.
     ].
 
     osType = 'hpux' ifTrue:[
-	"
-	 link it to a shared object with 'ld -b -B immediate'
-	"
-	needSharedObject := true.
-	ldArg := '-b -B immediate'.
+        "
+         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 , (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'.
+        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 , (self objectFileExtension).
     needSharedObject ifTrue:[
-	self activityNotification:'generating shared object'.
-
-	soFileName := './' , baseFileName , (self sharedLibraryExtension). 
-	OperatingSystem removeFile:soFileName.
-	ld := ld , ' ' , ldArg , ' ', 
-		 (SearchedLibraries asStringCollection asStringWith: $ ), 
-		 ' -o ' , soFileName , ' ' , oFileName.
-
-	Verbose ifTrue:[
-	    'linking with:' infoPrintCR.
-	    '   ' infoPrint. ld infoPrintCR.
-	].         
-	ok := OperatingSystem 
-		executeCommand:(ld , ' >errorOutput 2>&1').
-
-	ok ifFalse:[
-	    output := 'errorOutput' asFilename contents asString.
-	    Transcript showCR:'linker error message:'.
-	    Transcript showCR:output; 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 , ' ', 
+                 (SearchedLibraries asStringCollection asStringWith: $ ), 
+                 ' -o ' , soFileName , ' ' , oFileName.
+
+        Verbose ifTrue:[
+            'linking with:' infoPrintCR.
+            '   ' infoPrint. ld infoPrintCR.
+        ].         
+        ok := OperatingSystem 
+                executeCommand:(ld , ' >errorOutput 2>&1').
+
+        ok ifFalse:[
+            output := 'errorOutput' asFilename contents asString.
+            Transcript showCR:'linker error message:'.
+            Transcript showCR:output; endEntry.
+        ].
+
+        OperatingSystem removeFile:oFileName.
+        expFileName notNil ifTrue:[
+            OperatingSystem removeFile:expFileName
+        ].
+        ^ soFileName. 
     ].
 
     "
@@ -2686,7 +2686,7 @@
     "
     ^ oFileName
 
-    "Modified: / 15.2.1999 / 15:52:48 / cg"
+    "Modified: / 23.12.1999 / 21:10:57 / cg"
 ! !
 
 !ObjectFileLoader class methodsFor:'lowlevel object loading'!
@@ -4038,6 +4038,6 @@
 !ObjectFileLoader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.211 1999-12-17 11:45:37 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.212 1999-12-23 20:08:47 cg Exp $'
 ! !
 ObjectFileLoader initialize!