Re: [AD] proposed patch for nicer asm symbols exports

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Sam Hocevar wrote:

On Thu, Aug 05, 2004, Peter Wang wrote:
You forgot to attach :)

  Woops. Here it is.

Thanks, I reworked it to the attached patch. Note: the patch breaks an ugly hack in makefile.osx.


BTW, I was under the impression that the Debian folks were very careful about not having any non-PIC code in shared libraries? There was some trouble with the DGA2 module, which linked to libXxf86dga, and at that time libXxf86dga was only available in the statically linked flavour. I don't know the full story though.

I also wanted to point out this patch of your patch: doesn't this mean your users' Allegro binaries will have unnecessary dependencies?

--- allegro4.1-4.1.15.orig/misc/allegro-config.in
+++ allegro4.1-4.1.15/misc/allegro-config.in
@@ -180,9 +184,9 @@
if test "$echo_libs" = "yes"; then
   libdirs=-L${exec_prefix}/lib
   if test "$static_libs" = "yes"; then
-      echo $libdirs $allegro_ldflags -l${lib_type} $allegro_libs
+      echo $libdirs $allegro_ldflags -l${lib_type} ${allegro_libs}
   else
- echo $libdirs $allegro_ldflags -l${lib_type}-${version} -l${lib_type}_unsharable + echo $libdirs $allegro_ldflags -l${lib_type}-${version} ${allegro_libs}
   fi
fi


Peter

? ChangeLog
? solid-nopatch.txt
? solid-patch3.txt
? obj/unix/asmdef
Index: aclocal.m4
===================================================================
RCS file: /cvsroot/alleg/allegro/aclocal.m4,v
retrieving revision 1.64
diff -u -r1.64 aclocal.m4
--- aclocal.m4	27 Jul 2004 10:33:21 -0000	1.64
+++ aclocal.m4	5 Aug 2004 10:10:18 -0000
@@ -172,7 +172,6 @@
       dnl Use libdl if found, else assume dl* functions in libc.
       AC_CHECK_LIB(dl, dlopen,
         [LIBS="-ldl $LIBS"])
-      LDFLAGS="-Wl,-export-dynamic $LDFLAGS"
     fi])
 fi
 ])
Index: configure.in
===================================================================
RCS file: /cvsroot/alleg/allegro/configure.in,v
retrieving revision 1.80
diff -u -r1.80 configure.in
--- configure.in	27 Jul 2004 10:33:21 -0000	1.80
+++ configure.in	5 Aug 2004 10:10:19 -0000
@@ -276,8 +276,8 @@
   allegro_static_libraries=yes
   _programs="statically linked $_programs"
 else
-  LIBALLEG="lib/unix/lib${LIB_TO_LINK}-\$(shared_version).so lib/unix/lib${LIB_TO_LINK}_unsharable.a"
-  LINK_LIBALLEG="-Llib/unix -l${LIB_TO_LINK}-\$(shared_version) -l${LIB_TO_LINK}_unsharable -lm"
+  LIBALLEG="lib/unix/lib${LIB_TO_LINK}-\$(shared_version).so"
+  LINK_LIBALLEG="-Llib/unix -l${LIB_TO_LINK}-\$(shared_version) -lm"
   LINK_WITH_STATIC_LIBS=no
   allegro_shared_libraries=yes
   _programs="dynamically linked $_programs"
@@ -316,15 +316,15 @@
 
   _libraries="$_libraries shared"
   if test "X$allegro_build_normal_library" = "Xyes"; then
-    ALLEGRO_LIB_TARGETS="$ALLEGRO_LIB_TARGETS lib/unix/liballeg-\$(shared_version).so lib/unix/liballeg_unsharable.a"
+    ALLEGRO_LIB_TARGETS="$ALLEGRO_LIB_TARGETS lib/unix/liballeg-\$(shared_version).so"
     _libraries="$_libraries release"
   fi
   if test "X$allegro_build_debugging_library" = "Xyes"; then
-    ALLEGRO_LIB_TARGETS="$ALLEGRO_LIB_TARGETS lib/unix/liballd-\$(shared_version).so lib/unix/liballd_unsharable.a"
+    ALLEGRO_LIB_TARGETS="$ALLEGRO_LIB_TARGETS lib/unix/liballd-\$(shared_version).so"
     _libraries="$_libraries debug"
   fi
   if test "X$allegro_build_profiling_library" = "Xyes"; then
-    ALLEGRO_LIB_TARGETS="$ALLEGRO_LIB_TARGETS lib/unix/liballp-\$(shared_version).so lib/unix/liballp_unsharable.a"
+    ALLEGRO_LIB_TARGETS="$ALLEGRO_LIB_TARGETS lib/unix/liballp-\$(shared_version).so"
     _libraries="$_libraries profile"
   fi
 fi
Index: makefile.be
===================================================================
RCS file: /cvsroot/alleg/allegro/makefile.be,v
retrieving revision 1.46
diff -u -r1.46 makefile.be
--- makefile.be	29 Nov 2003 07:51:59 -0000	1.46
+++ makefile.be	5 Aug 2004 10:10:20 -0000
@@ -164,7 +164,6 @@
 	sed -e "s/@LDFLAGS@//" temp > temp2
 	sed -e "s/@LIBS@/$(LIBRARIES)/" temp2 > temp
 	sed -e "s/include/headers/" temp >temp2
-	sed -e "s/ -l\$${lib_type}_unsharable//" temp2 >temp
 	sed -e "s/libdirs=-L\$${exec_prefix}\/lib/libdirs=\"-L\$${exec_prefix}\/lib\/x86 -L\/boot\/home\/config\/lib\"/" temp >/bin/allegro-config
 	rm -f temp temp2
 	chmod a+x /bin/allegro-config
Index: makefile.in
===================================================================
RCS file: /cvsroot/alleg/allegro/makefile.in,v
retrieving revision 1.66
diff -u -r1.66 makefile.in
--- makefile.in	5 Aug 2004 08:18:17 -0000	1.66
+++ makefile.in	5 Aug 2004 10:10:20 -0000
@@ -466,7 +466,6 @@
 	  if test -f $(LIBDIR)/lib$${l}-$(shared_version).so; then \
 	    echo Installing $(LIBDIR)/lib$${l}-$(shared_version).so to $(DESTDIR)$(libdir); \
 	    $(INSTALL_DATA) $(LIBDIR)/lib$${l}-$(shared_version).so $(DESTDIR)$(libdir)/; \
-	    $(INSTALL_DATA) $(LIBDIR)/lib$${l}_unsharable.a $(DESTDIR)$(libdir)/; \
 	  fi; \
 	done
 	@if test -n "$(ALLEGRO_MODULE_TARGETS)"; then \
@@ -592,7 +591,6 @@
 uninstall-lib:
 	@echo "Uninstalling libraries..."
 	@for l in alleg alld allp; do \
-	  rm -f $(libdir)/lib$${l}_unsharable.a; \
 	  rm -f $(libdir)/lib$${l}.a; \
 	done
 	rm -f $(bindir)/allegro-config
Index: makefile.lst
===================================================================
RCS file: /cvsroot/alleg/allegro/makefile.lst,v
retrieving revision 1.101
diff -u -r1.101 makefile.lst
--- makefile.lst	5 Aug 2004 08:18:17 -0000	1.101
+++ makefile.lst	5 Aug 2004 10:10:21 -0000
@@ -276,7 +276,6 @@
 	src/unix/jack.c \
 	src/unix/udjgpp.c \
 	src/unix/udrvlist.c \
-	src/unix/udummy.c \
 	src/unix/uesd.c \
 	src/unix/ufile.c \
 	src/unix/ugfxdrv.c \
Index: misc/allegro-config.in
===================================================================
RCS file: /cvsroot/alleg/allegro/misc/allegro-config.in,v
retrieving revision 1.39
diff -u -r1.39 allegro-config.in
--- misc/allegro-config.in	29 Jul 2004 08:27:35 -0000	1.39
+++ misc/allegro-config.in	5 Aug 2004 10:10:22 -0000
@@ -182,7 +182,7 @@
    if test "$static_libs" = "yes"; then
       echo $libdirs $allegro_ldflags -l${lib_type} $allegro_libs
    else
-      echo $libdirs $allegro_ldflags -l${lib_type}-${version} -l${lib_type}_unsharable
+      echo $libdirs $allegro_ldflags -l${lib_type}-${version}
    fi
 fi
 
Index: misc/deplib.sh
===================================================================
RCS file: /cvsroot/alleg/allegro/misc/deplib.sh,v
retrieving revision 1.8
diff -u -r1.8 deplib.sh
--- misc/deplib.sh	17 May 2003 12:58:09 -0000	1.8
+++ misc/deplib.sh	5 Aug 2004 10:10:22 -0000
@@ -12,9 +12,6 @@
 
     sharelib="lib${1}-\$(shared_version).so"
     shareobj="\$(${2}_SHARED_OBJECTS)"
-
-    unsharelib="lib${1}_unsharable.a"
-    unshareobj="\$(${2}_UNSHARED_OBJECTS)"
     
     echo "\$(LIBDIR)/${staticlib}: ${staticobj}"
     echo "	rm -f \$@"
@@ -26,22 +23,23 @@
     # eb: Yes, but the GNU C Compiler doesn't always spell 'gcc'
     echo "	\$(CC) -shared -o \$@ ${shareobj} ${3} \$(LDFLAGS) -Wl,-h,lib${1}.so.\$(shared_major_minor) \$(LIBS)"
     echo ""
-    echo "\$(LIBDIR)/${unsharelib}: ${unshareobj}"
-    echo "	rm -f \$@"
-    echo "	\$(AR) \$@ ${unshareobj}"
 }
 
 
-# See src/unix/udummy.c for the rationale
+# Once there was a distinction between sharable object files and unsharable
+# object files on Unix. The unsharable object files came from the hand-written
+# assembly files, which was not PIC. These could not be put into the standard
+# shared library and had to be statically linked to the user's binary. Yet,
+# only x86 architectures had hand-written assembly code, and they could mix PIC
+# and non-PIC code.  The sharable/unsharable dichotomy was unnecessary and was
+# finally removed, although a vestige of it still remains here (it may help to
+# reintroduce it later on different architectures).
+
 sources=`echo $* | sed 's,[^	 ]*/,,g'`
-sharable_sources=`echo $sources | sed 's,[^.	 ]*\.s,,g'`
-sharable_sources=`echo $sharable_sources | sed 's,[	 ]*udummy\.c,,g'`
-unsharable_sources=`echo $sources | sed 's,[^.	 ]*\.[^s],,g'`
-unsharable_sources=`echo $unsharable_sources udummy.c`
+sharable_sources=$sources
 
 objects=`echo $sources | sed 's,\.[^.	 ]*,,g'`
-sharable_objects=`echo $sharable_sources | sed 's,\.[^.	 ]*,,g'`
-unsharable_objects=`echo $unsharable_sources | sed 's,\.[^.	 ]*,,g'`
+sharable_objects=$objects
 
 
 # Normal library.
@@ -61,14 +59,6 @@
   fi
 done
 echo "$prev"
-prev="LIBALLEG_UNSHARED_OBJECTS ="
-for file in .. $unsharable_objects; do
-  if test "$file" != ..; then
-    echo "$prev \\"
-    prev="  \$(OBJDIR)/shared/alleg/$file\$(OBJ)"
-  fi
-done
-echo "$prev"
 echo ""
 write_code alleg LIBALLEG -s
 echo ""
@@ -92,14 +82,6 @@
   fi
 done
 echo "$prev"
-prev="LIBALLD_UNSHARED_OBJECTS ="
-for file in .. $unsharable_objects; do
-  if test "$file" != ..; then
-    echo "$prev \\"
-    prev="  \$(OBJDIR)/shared/alld/$file\$(OBJ)"
-  fi
-done
-echo "$prev"
 echo ""
 write_code alld LIBALLD -g
 echo ""
@@ -123,14 +105,6 @@
   fi
 done
 echo "$prev"
-prev="LIBALLP_UNSHARED_OBJECTS ="
-for file in .. $unsharable_objects; do
-  if test "$file" != ..; then
-    echo "$prev \\"
-    prev="  \$(OBJDIR)/shared/allp/$file\$(OBJ)"
-  fi
-done
-echo "$prev"
 echo ""
 write_code allp LIBALLP -pg
 echo ""
@@ -198,7 +172,7 @@
     if test "$ext" = "c"; then
       echo "	\$(COMPILE_NORMAL) \$(ALLEGRO_SHAREDLIB_CFLAGS) -c \$(srcdir)/$file -o \$(OBJDIR)/shared/alleg/$name\$(OBJ)"
     else
-      echo "	\$(COMPILE_S_NORMAL) -c \$(srcdir)/$file -o \$(OBJDIR)/shared/alleg/$name\$(OBJ)"
+      echo "	\$(COMPILE_S_NORMAL) \$(ALLEGRO_SHAREDLIB_CFLAGS) -c \$(srcdir)/$file -o \$(OBJDIR)/shared/alleg/$name\$(OBJ)"
     fi
     echo ""
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/