[PATCH] Make libf2c a shared library fix for AIX and POSIX

David Edelsohn dje@watson.ibm.com
Wed Oct 10 15:01:00 GMT 2001


Toon, 

	Have you had a chance to look at the libf2c shared library problem
of linking too many object files?  This is a regression so it either needs
to be fixed or it will be reverted.

	I think the following patch basically is what is needed, although
Alexandre needs to comment on whether this is correct libtool syntax.  We
could generate the library names from SUBDIRS using a GNU Make
transformation, but we may not want to add another GNU Make dependency.
The following patch fixes the problem on AIX.

Thanks, David


	* Makefile.in: Do not include SUBDIRS in objlist.  Create
	libg2c.so from F2CEXT and SUBDIRS archives.
	* libF77/Makefile.in: Create archive.
	* libI77/Makefile.in: Same.
	* libU77/Makefile.in: Same.

Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/egcs/libf2c/Makefile.in,v
retrieving revision 1.38
diff -c -p -r1.38 Makefile.in
*** Makefile.in	2001/10/05 06:51:46	1.38
--- Makefile.in	2001/10/10 21:46:20
*************** $(LIBG2C): s-libi77 s-libf77 s-libu77 s-
*** 142,157 ****
  	set -e; \
  	rm -f objlist ;\
  	touch objlist ;\
- 	for i in $(SUBDIRS) ;\
- 	do \
- 	  (cd $$i && $(MAKE) $(FLAGS_TO_PASS) objlist) ;\
- 	done ;\
- 	objs="`cat objlist`" ;\
  	for i in $(F2CEXT); do objs="$$objs libE77/L$$i.lo"; done ;\
  	echo -n $$objs > objlist 
  	$(LIBTOOL) --mode=link $(CC) -o $@ \
  	  -version-info $(VERSION_MAJOR):$(VERSION_MINOR):$(VERSION_SUB) \
! 	  -rpath $(prefix)/lib `cat objlist` -lc -lm
  
  i77:
  	cd libI77; $(MAKE) $(FLAGS_TO_PASS) all
--- 142,152 ----
  	set -e; \
  	rm -f objlist ;\
  	touch objlist ;\
  	for i in $(F2CEXT); do objs="$$objs libE77/L$$i.lo"; done ;\
  	echo -n $$objs > objlist 
  	$(LIBTOOL) --mode=link $(CC) -o $@ \
  	  -version-info $(VERSION_MAJOR):$(VERSION_MINOR):$(VERSION_SUB) \
! 	  -rpath $(prefix)/lib `cat objlist` libF77.la libI77.la libU77.la -lc -lm
  
  i77:
  	cd libI77; $(MAKE) $(FLAGS_TO_PASS) all
Index: libF77/Makefile.in
===================================================================
RCS file: /cvs/gcc/egcs/libf2c/libF77/Makefile.in,v
retrieving revision 1.10
diff -c -p -r1.10 Makefile.in
*** Makefile.in	2001/10/03 06:10:50	1.10
--- Makefile.in	2001/10/10 21:46:21
*************** ALL_CFLAGS = -I. -I$(srcdir) -I$(G2C_H_D
*** 52,57 ****
--- 52,59 ----
  .c.lo:
  	@LIBTOOL@ --mode=compile $(CC) -c -DSkip_f2c_Undefs $(ALL_CFLAGS) $<
  
+ LINK = @LIBTOOL@ --mode=link $(CC) $(ALL_CFLAGS) -o $@
+ 
  MISC =	F77_aloc.lo VersionF.lo s_rnge.lo abort_.lo getarg_.lo iargc_.lo\
  	getenv_.lo signal_.lo s_stop.lo s_paus.lo system_.lo cabs.lo\
  	derf_.lo derfc_.lo erf_.lo erfc_.lo sig_die.lo exit_.lo setarg.lo setsig.lo
*************** OBJS = $(MISC) $(POW) $(CX) $(DCX) $(REA
*** 80,87 ****
  
  all: ../s-libf77 ../libfrtbegin.a
  
! ../s-libf77: $(OBJS)
  	echo timestamp > ../s-libf77
  
  objlist:
  	objs="`cat ../objlist`" ; for i in $(OBJS) ; do \
--- 82,92 ----
  
  all: ../s-libf77 ../libfrtbegin.a
  
! ../s-libf77: ../libF77.la
  	echo timestamp > ../s-libf77
+ 
+ ../libF77.la: $(OBJS)
+ 	$(LINK) $(OBJS)
  
  objlist:
  	objs="`cat ../objlist`" ; for i in $(OBJS) ; do \
Index: libI77/Makefile.in
===================================================================
RCS file: /cvs/gcc/egcs/libf2c/libI77/Makefile.in,v
retrieving revision 1.14
diff -c -p -r1.14 Makefile.in
*** Makefile.in	2001/10/02 16:54:25	1.14
--- Makefile.in	2001/10/10 21:46:21
*************** ALL_CFLAGS = -I. -I$(srcdir) -I$(G2C_H_D
*** 51,56 ****
--- 51,58 ----
  .c.lo:
  	@LIBTOOL@ --mode=compile $(CC) -c -DSkip_f2c_Undefs -DAllow_TYQUAD $(ALL_CFLAGS) $<
  
+ LINK = @LIBTOOL@ --mode=link $(CC) $(ALL_CFLAGS) -o $@
+ 
  OBJS =	VersionI.lo backspace.lo close.lo dfe.lo dolio.lo due.lo endfile.lo err.lo \
  	fmt.lo fmtlib.lo iio.lo ilnw.lo inquire.lo lread.lo lwrite.lo open.lo \
  	rdfmt.lo rewind.lo rsfe.lo rsli.lo rsne.lo sfe.lo sue.lo typesize.lo uio.lo \
*************** OBJS =	VersionI.lo backspace.lo close.lo
*** 59,66 ****
  
  all: ../s-libi77
  
! ../s-libi77: $(OBJS)
  	echo timestamp > ../s-libi77
  
  objlist:
  	objs="`cat ../objlist`" ; for i in $(OBJS) ; do \
--- 61,71 ----
  
  all: ../s-libi77
  
! ../s-libi77: ../libI77.la
  	echo timestamp > ../s-libi77
+ 
+ ../libI77.la: $(OBJS)
+ 	$(LINK) $(OBJS)
  
  objlist:
  	objs="`cat ../objlist`" ; for i in $(OBJS) ; do \
Index: libU77/Makefile.in
===================================================================
RCS file: /cvs/gcc/egcs/libf2c/libU77/Makefile.in,v
retrieving revision 1.16
diff -c -p -r1.16 Makefile.in
*** Makefile.in	2001/10/02 16:54:26	1.16
--- Makefile.in	2001/10/10 21:46:21
*************** G77DIR = ../../../gcc/
*** 55,60 ****
--- 55,62 ----
  .c.lo:
  	@LIBTOOL@ --mode=compile $(CC) -c -DSkip_f2c_Undefs $(ALL_CFLAGS) $<
  
+ LINK = @LIBTOOL@ --mode=link $(CC) $(ALL_CFLAGS) -o $@
+ 
  OBJS =  VersionU.lo gerror_.lo perror_.lo ierrno_.lo itime_.lo time_.lo \
  	unlink_.lo fnum_.lo getpid_.lo getuid_.lo getgid_.lo kill_.lo rand_.lo \
  	srand_.lo irand_.lo sleep_.lo idate_.lo ctime_.lo etime_.lo \
*************** SRCS =  Version.c gerror_.c perror_.c ie
*** 78,85 ****
  
  all: ../s-libu77
  
! ../s-libu77: $(OBJS)
  	echo timestamp > ../s-libu77
  
  objlist:
  	objs="`cat ../objlist`" ; for i in $(OBJS) ; do \
--- 80,90 ----
  
  all: ../s-libu77
  
! ../s-libu77: ../libU77.la
  	echo timestamp > ../s-libu77
+ 
+ ../libU77.la: $(OBJS)
+ 	$(LINK) $(OBJS)
  
  objlist:
  	objs="`cat ../objlist`" ; for i in $(OBJS) ; do \



More information about the Gcc-patches mailing list