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]

Re: An interface patch


> 
>   In message <19990718190838.F0A1A3FC1@varesearch.com>you write:
>   > Here is a Linux/alpha/ppc patch for config.if. The problem is for the
>   > same glibc 2.1 source, if you compile it with egcs 1.1.2, libc.so won't
>   > have the .eh_frame section. However, if you recompile it with gcc 2.95,
>   > now libc.so will have the .eh_frame section. For C++, those 2 libc.so's
>   > compiled with different compilers may not be binary compatible. This
>   > patch tries to detect it and appends "eh-" to "libc_interface" if
>   > the .eh_frame section is in libc.so. Please check it out.
>   > 
>   > BTW, I seem to remember Linux/PPC supports DWARF2 based EH now. But
>   > I didn't find anything in egcs.
> I think the patch is basically OK.  However, I don't want to fight this
> stuff again with the mips, m68k, pa, arm, sh, etc linux ports.  It seems
> to me we should remove the checks for alpha/powerpc and always encode
> whether or not the port is using dwarf2 based eh frame records.

It should work.

> 
> What would be the consequences of making this kind of change for gcc-2.95.1?
> 

Not much. It shouldn't break any existing binaries. However, for x86,
it will introduce a new libstdc++ since it encodes EH in soname.

We can do

1. For existing archs with dwarf2 based eh, no change.
2. For any archs without dwarf2 based eh, use it.

It should cover everything without an unnecessary new libstdc++.



-- 
H.J. Lu (hjl@gnu.org)
---
Thu Aug  5 08:36:45 1999  H.J. Lu  (hjl@gnu.org)

	* config.if (libc_interface): If not sure, check libc.so and
	append "eh-" if libc.so has the .eh_frame section.

--- ../../import/gcc-2.95/egcs/config.if	Sun Oct 18 10:37:10 1998
+++ ./config.if	Thu Aug  5 08:36:00 1999
@@ -84,4 +84,34 @@ EOF
     libc_interface=-
     ;;
   esac
+
+  # It is a very tricky since C++ is switched to DWARF2 based EH on
+  # Linux/Alpha and Linux/PPC in gcc 2.95. Depending on the compiler
+  # used to compile glibc, libc.so is different. We have to encode it.
+  case ${target_os} in
+  *linux*libc1*|*linux*libc5*)
+    ;;
+  *linux*gnu*)
+    case ${target_alias} in
+    *i[3456]86*|*m68k*|*mips*|*sparc*)
+      # Known to have EH today.
+      ;;
+    *)
+      if [ ${target_alias} = ${build_alias} ]
+      then
+	# Check if libc.so has the .eh_frame section.
+	OBJDUMP_FOR_TARGET=${OBJDUMP_FOR_TARGET-objdump}
+	${OBJDUMP_FOR_TARGET} -h /lib/libc.so.6* | grep .eh_frame > /dev/null 2>&1
+	if [ "$?" = 0 ]
+	then
+	  libc_interface=${libc_interface}eh-
+	fi
+      else
+	# FIXME: Cross compiling. Assume glibc is compiled with EH.
+	libc_interface=${libc_interface}eh-
+      fi
+      ;;
+    esac
+    ;;
+  esac
 fi


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