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]

[PATCH] Fix -print-multi-os-directory for aarch64


Hi!

AFAIK aarch64 libraries are supposed to go into /usr/lib64 etc.
directories similarly to x86-64 etc., but as aarch64 isn't a true
multilib target (having two different backends for 32-bit vs. 64-bit code),
currently gcc -print-multi-os-directory prints . instead of ../lib64.

The following patch fixes that.  As for --disable-multilib purposes
gcc.c does:
      /* When --disable-multilib was used but target defines
         MULTILIB_OSDIRNAMES, entries starting with .: (and not starting
         with .:: for multiarch configurations) are there just to find
         multilib_os_dir, so skip them from output.  */
      if (this_path[0] == '.' && this_path[1] == ':' && this_path[2] != ':')
        skip = 1;
we need to actually emit
static const char *const multilib_raw[] = {
". ;",
".:../lib64 ;",
NULL
};
for --disable-multiarch resp.
static const char *const multilib_raw[] = {
". ;",
".:../lib64:aarch64-linux-gnu ;",
NULL
};
for --enable-multiarch.  Tested (with cross compiler) configured with
--target aarch64-linux --enable-languages=c {,--disable-multilib} {,--enable-multarch}
(all 4 combinations) and output of all
./xgcc -B ./ --print-{multiarch,multi-lib,multi-directory,multi-os-directory}
looks good to me with it (i.e. as before the patch, except
--print-multi-so-directory prints ../lib64 instead of . previously.

Ok for trunk?

2013-03-07  Jakub Jelinek  <jakub@redhat.com>

	* config/aarch64/t-aarch64-linux (MULTARCH_DIRNAME): Remove.
	(MULTILIB_OSDIRNAMES): Set.
	* genmultilib: If defaultosdirname doesn't start with :: , set
	defaultosdirname2 instead, clear it and emit two . multilib_raw
	entries instead of just one.

--- gcc/config/aarch64/t-aarch64-linux.jj	2013-01-11 09:03:10.000000000 +0100
+++ gcc/config/aarch64/t-aarch64-linux	2013-03-07 11:23:07.602568188 +0100
@@ -22,4 +22,4 @@ LIB1ASMSRC   = aarch64/lib1funcs.asm
 LIB1ASMFUNCS = _aarch64_sync_cache_range
 
 AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
-MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
+MULTILIB_OSDIRNAMES = .=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
--- gcc/genmultilib.jj	2013-01-13 13:23:38.000000000 +0100
+++ gcc/genmultilib	2013-03-07 11:35:22.881982721 +0100
@@ -267,6 +267,7 @@ fi
 # names.
 toosdirnames=
 defaultosdirname=
+defaultosdirname2=
 if [ -n "${multiarch}" ]; then
   defaultosdirname=::${multiarch}
 fi
@@ -280,6 +281,13 @@ if [ -n "${osdirnames}" ]; then
 	if [ -n "${multiarch}" ]; then
 	  defaultosdirname=${defaultosdirname}:${multiarch}
 	fi
+	case "$defaultosdirname" in
+	  ::*) ;;
+	  *)
+	    defaultosdirname2=${defaultosdirname}
+	    defaultosdirname=
+	    ;;
+	esac
 	shift
 	;;
       *=*)
@@ -352,6 +360,7 @@ for set in ${options}; do
 done
 optout=`echo ${optout} | sed -e 's/^ //'`
 echo "\".${defaultosdirname} ${optout};\","
+[ -n "${defaultosdirname2}" ] && echo "\".${defaultosdirname2} ${optout};\","
 
 # This part of code convert an option combination to
 # its corresponding directory names.

	Jakub


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