spitbol / x64

SPITBOL x64 provides raw power and speed for non-numeric computation on the x86_64 architecture
GNU General Public License v3.0
256 stars 23 forks source link

Segfault when compiling statically linked binary #9

Closed KJ4TIP closed 1 year ago

KJ4TIP commented 6 years ago

When compiling the latest git version as of the time of writing (commit 24452ceb8f26711aceb4545c91e3eae20e03ab3f), the resulting sbl binary throws a segmentation fault upon running (even running with no arguments). Removing -static from CFLAGS appears to fix the problem. See patch below

diff --git a/makefile b/makefile
index e771c79..a2e1921 100644
--- a/makefile
+++ b/makefile
@@ -24,7 +24,7 @@ OSINT=./osint
 vpath %.c $(OSINT)

 ifeq   ($(DEBUG),0)
-CFLAGS= -D m64 -m64 -static 
+CFLAGS= -D m64 -m64
 else
 CFLAGS= -D m64 -g -m64
 endif
@@ -102,11 +102,11 @@ OBJS=     $(AOBJS) $(COBJS) $(HOBJS) $(LOBJS) $(SYSOBJS) $(VOBJS) $(MOBJS) $(NAOBJS)
 # link spitbol with static linking
 LIBS = 

-sbl: $(OBJS)
-       $(CC) $(CFLAGS) $(LIBS) -lm $(OBJS) -osbl
+#sbl: $(OBJS)
+#      $(CC) $(CFLAGS) $(LIBS) -lm $(OBJS) -osbl

 # link spitbol with dynamic linking
-spitbol-dynamic: $(OBJS)
+sbl: $(OBJS)
        $(CC) $(CFLAGS) $(OBJS) $(LIBS) -lm -osbl 

 # Assembly language dependencies:
CheyenneWills commented 1 year ago

I know that this is an old issue.

Static linking seems to be be okay with the latest master / and the new development branch.

The dynamic linking appears to be broken and I haven't investigated it yet.

I'm going to close this issue and if the problem still exists, a new issue can be opened.