-static build for gst

Tagged:
Project:GNU Smalltalk
Component:VM
Category:bug
Priority:normal
Assigned:bonzinip
Status:fixed
Description

In Makefile.am we can see:
gst_LDFLAGS = -export-dynamic -static

The reason for -static is not clear to me. We have libgst.so and we can link dynamically.

But upon linking dynamically, gst becomes less stable, at least when working with FFI.

Anyone care to explain? Thanks

Updates

#1 submitted by Paolo Bonzini on Tue, 11/27/2007 - 20:32

I wanted to change this before rc2, but...

> But upon linking dynamically, gst becomes less stable, at
> least when working with FFI.

... can you expand on this?

#2 submitted by Ildar Mulyukov on Thu, 11/29/2007 - 08:51
Attachment:smalltalk-dynamic-bins.patch (1.56 KB)

With previous releases (e.g. 2.95c) I could build gst till the end, install it and launch it. With 2.95f I have ./cofigure && make failed:

./gst --no-user-files --kernel-dir="/home/ildar/tmp/RPM/BUILD/smalltalk-2.95f/kernel" -I "/home/ildar/tmp/RPM/BUILD/smalltalk-2.95f/gst.im" -iQ /dev/null
BlockClosure new "<0x40301398>" did not understand selector /var/tmp/RPM/BUILD/smalltalk-2.95f/kernel/ObjMemory.st:628: Aborted
(ip 8)BlockClosure>>#ifCurtailed:
(ip 10)Delay class>>#runDelayProcess
(ip 4)[] in Delay class>>#startDelayLoop
(ip 28)[] in Process>>#onBlock:at:suspend:
(ip 10) BlockClosure>>#on:do:
(ip 14)[] in Process>>#onBlock:at:suspend:
(ip 2) BlockClosure>>#ensure:
(ip 10)[] in Process>>#onBlock:at:suspend:
(ip 14)BlockContext class>>#fromClosure:parent:
make[2]: *** [gst.im] Aborted

The only change I made is in the _simple_ patch.

#3 submitted by Paolo Bonzini on Thu, 11/29/2007 - 12:04
Assigned to:Unassigned» bonzinip

I can reproduce it.

#4 submitted by Paolo Bonzini on Mon, 12/10/2007 - 08:11
Priority:normal» critical

Reduced test case (from arrays.st)

SortedCollection extend [
    SortedCollection class >> bug2 [
        ^##(#(8 6 9 10) asSortedCollection)
    ]

    bug: a [
        self sortFrom: lastOrdered + 1 to: lastIndex.
        ^(lastOrdered + 1 to: lastIndex) collect: [:each | a].
    ]
]

^SortedCollection bug2 bug: 5

#5 submitted by Paolo Bonzini on Mon, 12/10/2007 - 09:23
Status:active» fixed

Fixed with this simple patch:

--- orig/libgst/md-config.h
+++ mod/libgst/md-config.h
@@ -87,13 +87,7 @@
 # define REG_AVAILABILITY 0
 # define __DECL_REG1 __asm("%esi")
 # define __DECL_REG2 __asm("%edi")
-# if defined __APPLE__
-#  define __DECL_REG3 /* bug on Apple GCC? */
-# elif defined __PIC__ || defined __pic__
-#  define __DECL_REG3 __asm("%edx")   /* Don't conflict with GOT pointer... */
-# else
-#  define __DECL_REG3 __asm("%ebx")   /* ...but prefer a callee-save reg.  */
-# endif
+# define __DECL_REG3 /* no more caller-save regs if PIC is in use!  */
 #endif
 
 #if !defined(__DECL_REG1) && defined(PPC) || defined(_POWER) || defined(_IBMR2)

I have not yet removed the flag though.

#6 submitted by Paolo Bonzini on Mon, 12/10/2007 - 17:05
Priority:critical» normal
Status:fixed» active

I see what you mean with "FFI is less stable". GDBM tests fails, and on x86-64 actually I cannot even build gst. I think for 3.0 I'll go with static linking.

#7 submitted by Paolo Bonzini on Mon, 12/10/2007 - 18:31

Doh, I know what's happening. It's enough to define NO_MALLOC_OVERRIDE to fix it... and a lot of code just becomes dead...

#8 submitted by Paolo Bonzini on Tue, 12/11/2007 - 09:47
Status:active» fixed

fixed in 2.95g

User login