PATCH: Make .eh_frame sections read-only on 64-bit Solaris/x86
Rainer Orth
ro@CeBiTec.Uni-Bielefeld.DE
Tue Jan 19 19:42:00 GMT 2010
Eric Botcazou <ebotcazou@adacore.com> writes:
>> I'll probably add a check to gcc's gcc/configure.ac to guard against
>> this, but the proper fix seems to make gcc and gas consistent.
>
> There is a check already, it will disable the CFI directives if the section is
> made again read-only, so you'll need to invert it for x86-64.
The check certainly needs to be augmented for Solaris/x64, but right now
it tests only the 32-bit case, where the .eh_frame section remains
read-write. I'll do this in a second step once I've got agreement with
the Sun linker guys if they plan to change something about ro/rw section
mixing, either in general or at least for .eh_frame sections.
>> It would be good to get this both into binutils mainline and the 2.20
>> branch so we can point people at the gas 2.20.1 release that works in
>> time for the gcc 4.5 release.
>
> Are you sure it's a patch against the trunk? My pristine tree has:
>
> /* The Sun linker doesn't merge read-only and read-write sections into
> a single read-write section so we must force all EH frame sections
> to be read-write. */
> #define DWARF2_EH_FRAME_READ_ONLY 0
Sorry, the patch was indeed nonsense as is. It was created in a
binutils 2.20 tree used to build my test gas, but without use of version
control ;-( The proper patch against cvs mainline is included below;
te-solaris.h is unchanged since 2.20, so it applies to both.
I'm using the SEC_NO_FLAGS and SEC_READONLY values below to make it
obvious that DWARF2_EH_FRAME_READ_ONLY isn't boolean but SEC_* flags
or'ed together.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
Index: gas/config/te-solaris.h
===================================================================
RCS file: /cvs/src/src/gas/config/te-solaris.h,v
retrieving revision 1.1
diff -u -p -r1.1 te-solaris.h
--- gas/config/te-solaris.h 26 Sep 2008 07:02:44 -0000 1.1
+++ gas/config/te-solaris.h 19 Jan 2010 19:02:34 -0000
@@ -1,4 +1,4 @@
-/* Copyright 2008 Free Software Foundation, Inc.
+/* Copyright 2008, 2010 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -24,7 +24,12 @@
/* The Sun linker doesn't merge read-only and read-write sections into
a single read-write section so we must force all EH frame sections
- to be read-write. */
-#define DWARF2_EH_FRAME_READ_ONLY 0
+ to be read-write on SPARC and 32-bit i386. */
+#ifdef TC_SPARC
+#define DWARF2_EH_FRAME_READ_ONLY SEC_NO_FLAGS
+#else
+#define DWARF2_EH_FRAME_READ_ONLY \
+ (bfd_get_arch_size (stdoutput) == 64 ? SEC_READONLY : SEC_NO_FLAGS)
+#endif
#include "obj-format.h"
More information about the Binutils
mailing list