This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix PR other/16513


I opened this PR on 2004-07-13 for an old problem on SPARC64/Solaris:

"This is a problem I've seen for ages (it affects 3.3.x, 3.4.x and mainline at
least) and I finally got around to wording it in technical terms.

On Solaris/SPARC, the 64-bit libraries are always installed in the sparcv9
subdirectory of the regular 'lib' directory, for example /usr/lib and
/usr/lib/sparcv9.

Therefore GCC must follow this rule for the libraries it installs.  This works
well for a multilib sparc-sun-solaris2.* compiler: the 64-bit libraries 
(either static or dynamic) are installed in $(prefix)/lib/sparcv9.  This 
almost works for a (multilib or not) sparc64-sun-solaris2.* compiler: the 
64-bit libraries are almost all installed in $(prefix)/lib/sparcv9, 
$(prefix)/lib containing either nothing (non-multilib) or the 32-bit 
libraries (multilib).

The only exception is libiberty.a: for a sparc64-sun-solaris2.* compiler, the
64-bit version is installed in $(prefix)/lib (and a 32-bit version is 
installed in $(prefix)/lib/sparcv7 in the multilib case), overriding a 
possible previous 32-bit libiberty.a installed by the sparc-sun-solaris2.* 
compiler.

The problem is that Libiberty's Makefile doesn't take into account the result 
of $(CC) -print-multi-os-directory for a native compiler (it apparently does 
for a cross-compiler), whereas all other libraries shipped with GCC do."

Same problem on amd64-*-* where the 32-bit libiberty.a is in $(PREFIX)/lib/32.


Peter Breitenlohner recently ran into it and decided to tackle it (thanks!).

The patch has been written against 4.1.2 by Peter, rediffed for mainline and 
bootstrapped/regtested/install-tested on AMD64/Linux by me, approved by DJ 
and approved by Mark for the 4.2 branch after a couple of days on mainline.

Applied to mainline.


2007-03-01  Peter Breitenlohner  <peb@mppmu.mpg.de>
            Eric Botcazou  <ebotcazou@libertysurf.fr>

libiberty/
	PR other/16513
	* Makefile.in: Install library under $(MULTIOSDIR), not $(MULTISUBDIR).
	Install headers in multilib independent location.


-- 
Eric Botcazou
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 122331)
+++ Makefile.in	(working copy)
@@ -336,15 +336,20 @@ libiberty.html : $(srcdir)/libiberty.tex
 INSTALL_DEST = @INSTALL_DEST@
 install: install_to_$(INSTALL_DEST) install-subdir
 
+# This is tricky.  Even though CC in the Makefile contains
+# multilib-specific flags, it's overridden by FLAGS_TO_PASS from the
+# default multilib, so we have to take LIBCFLAGS into account as well,
+# since it will be passed the multilib flags.
+MULTIOSDIR = `$(CC) $(LIBCFLAGS) -print-multi-os-directory`
 install_to_libdir: all
-	${mkinstalldirs} $(DESTDIR)$(libdir)$(MULTISUBDIR)
-	$(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)n
-	( cd $(DESTDIR)$(libdir)$(MULTISUBDIR) ; chmod 644 $(TARGETLIB)n ;$(RANLIB) $(TARGETLIB)n )
-	mv -f $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)n $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)
+	${mkinstalldirs} $(DESTDIR)$(libdir)/$(MULTIOSDIR)
+	$(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB)n
+	( cd $(DESTDIR)$(libdir)/$(MULTIOSDIR) ; chmod 644 $(TARGETLIB)n ;$(RANLIB) $(TARGETLIB)n )
+	mv -f $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB)n $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB)
 	if test -n "${target_header_dir}"; then \
 	  case "${target_header_dir}" in \
 	    /*)    thd=${target_header_dir};; \
-	    *)     thd=${includedir}${MULTISUBDIR}/${target_header_dir};; \
+	    *)     thd=${includedir}/${target_header_dir};; \
 	  esac; \
 	  ${mkinstalldirs} $(DESTDIR)$${thd}; \
 	  for h in ${INSTALLED_HEADERS}; do \
@@ -353,11 +358,6 @@ install_to_libdir: all
 	fi
 	@$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
 
-# This is tricky.  Even though CC in the Makefile contains
-# multilib-specific flags, it's overridden by FLAGS_TO_PASS from the
-# default multilib, so we have to take LIBCFLAGS into account as well,
-# since it will be passed the multilib flags.
-MULTIOSDIR = `$(CC) $(LIBCFLAGS) -print-multi-os-directory`
 install_to_tooldir: all
 	${mkinstalldirs} $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR)
 	$(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR)/$(TARGETLIB)n

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]