Commit 1a35e62d by Mark Mitchell Committed by Joseph Myers

crtstuff.c (IN_LIBGCC2): Define it.

2004-11-24  Mark Mitchell  <mark@codesourcery.com>
            Joseph Myers  <joseph@codesourcery.com>

	* crtstuff.c (IN_LIBGCC2): Define it.
	(EH_FRAME_SECTION_CONST): Check EH_TABLES_CAN_BE_READ_ONLY
	instead of HAVE_LD_RO_RW_SECTION_MIXING.
	* defaults.h (EH_TABLES_CAN_BE_READ_ONLY): New macro.
	* dwarf2out.c (named_section_eh_frame_section): Check
	EH_TABLES_CAN_BE_READ_ONLY.
	* except.c (default_exception_section): Likewise.
	* config/i386/sol2.h (EH_TABLES_CAN_BE_READ_ONLY): Define.
	* doc/tm.texi (EH_TABLES_CAN_BE_READ_ONLY): Document.

Co-Authored-By: Joseph Myers <joseph@codesourcery.com>

From-SVN: r91160
parent f78ce0c2
2004-11-24 Mark Mitchell <mark@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* crtstuff.c (IN_LIBGCC2): Define it.
(EH_FRAME_SECTION_CONST): Check EH_TABLES_CAN_BE_READ_ONLY
instead of HAVE_LD_RO_RW_SECTION_MIXING.
* defaults.h (EH_TABLES_CAN_BE_READ_ONLY): New macro.
* dwarf2out.c (named_section_eh_frame_section): Check
EH_TABLES_CAN_BE_READ_ONLY.
* except.c (default_exception_section): Likewise.
* config/i386/sol2.h (EH_TABLES_CAN_BE_READ_ONLY): Define.
* doc/tm.texi (EH_TABLES_CAN_BE_READ_ONLY): Document.
2004-11-24 Kazu Hirata <kazu@cs.umass.edu> 2004-11-24 Kazu Hirata <kazu@cs.umass.edu>
* tree-ssa-pre.c (phi_translate): Use find_edge to find the * tree-ssa-pre.c (phi_translate): Use find_edge to find the
......
...@@ -40,6 +40,15 @@ Boston, MA 02111-1307, USA. */ ...@@ -40,6 +40,15 @@ Boston, MA 02111-1307, USA. */
: DW_EH_PE_datarel)) \ : DW_EH_PE_datarel)) \
: DW_EH_PE_absptr) : DW_EH_PE_absptr)
/* The Solaris linker will not merge a read-only .eh_frame section
with a read-write .eh_frame section. None of the encodings used
with non-PIC code require runtime relocations. In 64-bit mode,
since there is no backwards compatibility issue, we use a read-only
section for .eh_frame. In 32-bit mode, we use a writable .eh_frame
section in order to be compatible with G++ for Solaris x86. */
#undef EH_TABLES_CAN_BE_READ_ONLY
#define EH_TABLES_CAN_BE_READ_ONLY (TARGET_64BIT)
/* Solaris 2/Intel as chokes on #line directives. */ /* Solaris 2/Intel as chokes on #line directives. */
#undef CPP_SPEC #undef CPP_SPEC
#define CPP_SPEC "%{.S:-P} %(cpp_subtarget)" #define CPP_SPEC "%{.S:-P} %(cpp_subtarget)"
......
...@@ -55,6 +55,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -55,6 +55,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
compiled for the target, and hence definitions concerning only the host compiled for the target, and hence definitions concerning only the host
do not apply. */ do not apply. */
#define IN_LIBGCC2
/* We include auto-host.h here to get HAVE_GAS_HIDDEN. This is /* We include auto-host.h here to get HAVE_GAS_HIDDEN. This is
supposedly valid even though this is a "target" file. */ supposedly valid even though this is a "target" file. */
#include "auto-host.h" #include "auto-host.h"
...@@ -92,7 +94,7 @@ call_ ## FUNC (void) \ ...@@ -92,7 +94,7 @@ call_ ## FUNC (void) \
#if defined(EH_FRAME_SECTION_NAME) && !defined(USE_PT_GNU_EH_FRAME) #if defined(EH_FRAME_SECTION_NAME) && !defined(USE_PT_GNU_EH_FRAME)
# define USE_EH_FRAME_REGISTRY # define USE_EH_FRAME_REGISTRY
#endif #endif
#if defined(EH_FRAME_SECTION_NAME) && defined(HAVE_LD_RO_RW_SECTION_MIXING) #if defined(EH_FRAME_SECTION_NAME) && EH_TABLES_CAN_BE_READ_ONLY
# define EH_FRAME_SECTION_CONST const # define EH_FRAME_SECTION_CONST const
#else #else
# define EH_FRAME_SECTION_CONST # define EH_FRAME_SECTION_CONST
......
...@@ -310,6 +310,26 @@ do { fputs (integer_asm_op (POINTER_SIZE / BITS_PER_UNIT, TRUE), FILE); \ ...@@ -310,6 +310,26 @@ do { fputs (integer_asm_op (POINTER_SIZE / BITS_PER_UNIT, TRUE), FILE); \
#endif #endif
#endif #endif
/* On many systems, different EH table encodings are used under
difference circumstances. Some will require runtime relocations;
some will not. For those that do not require runtime relocations,
we would like to make the table read-only. However, since the
read-only tables may need to be combined with read-write tables
that do require runtime relocation, it is not safe to make the
tables read-only unless the linker will merge read-only and
read-write sections into a single read-write section. If your
linker does not have this ability, but your system is such that no
encoding used with non-PIC code will ever require a runtime
relocation, then you can define EH_TABLES_CAN_BE_READ_ONLY to 1 in
your target configuration file. */
#ifndef EH_TABLES_CAN_BE_READ_ONLY
#ifdef HAVE_LD_RO_RW_SECTION_MIXING
#define EH_TABLES_CAN_BE_READ_ONLY 1
#else
#define EH_TABLES_CAN_BE_READ_ONLY 0
#endif
#endif
/* If we have named section and we support weak symbols, then use the /* If we have named section and we support weak symbols, then use the
.jcr section for recording java classes which need to be registered .jcr section for recording java classes which need to be registered
at program start-up time. */ at program start-up time. */
......
...@@ -7588,6 +7588,13 @@ Do not define this macro unless @code{TARGET_ASM_NAMED_SECTION} is ...@@ -7588,6 +7588,13 @@ Do not define this macro unless @code{TARGET_ASM_NAMED_SECTION} is
also defined. also defined.
@end defmac @end defmac
@defmac EH_TABLES_CAN_BE_READ_ONLY
Define this macro to 1 if your target is such that no frame unwind
information encoding used with non-PIC code will ever require a
runtime relocation, but the linker may not support merging read-only
and read-write sections into a single read-write section.
@end defmac
@defmac MASK_RETURN_ADDR @defmac MASK_RETURN_ADDR
An rtx used to mask the return address found via @code{RETURN_ADDR_RTX}, so An rtx used to mask the return address found via @code{RETURN_ADDR_RTX}, so
that it does not contain any extraneous set bits in it. that it does not contain any extraneous set bits in it.
......
...@@ -121,24 +121,29 @@ void ...@@ -121,24 +121,29 @@ void
named_section_eh_frame_section (void) named_section_eh_frame_section (void)
{ {
#ifdef EH_FRAME_SECTION_NAME #ifdef EH_FRAME_SECTION_NAME
#ifdef HAVE_LD_RO_RW_SECTION_MIXING
int fde_encoding = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/1, /*global=*/0);
int per_encoding = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/2, /*global=*/1);
int lsda_encoding = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/0, /*global=*/0);
int flags; int flags;
flags = (! flag_pic if (EH_TABLES_CAN_BE_READ_ONLY)
|| ((fde_encoding & 0x70) != DW_EH_PE_absptr {
&& (fde_encoding & 0x70) != DW_EH_PE_aligned int fde_encoding;
&& (per_encoding & 0x70) != DW_EH_PE_absptr int per_encoding;
&& (per_encoding & 0x70) != DW_EH_PE_aligned int lsda_encoding;
&& (lsda_encoding & 0x70) != DW_EH_PE_absptr
&& (lsda_encoding & 0x70) != DW_EH_PE_aligned)) fde_encoding = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/1, /*global=*/0);
? 0 : SECTION_WRITE; per_encoding = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/2, /*global=*/1);
lsda_encoding = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/0, /*global=*/0);
flags = (! flag_pic
|| ((fde_encoding & 0x70) != DW_EH_PE_absptr
&& (fde_encoding & 0x70) != DW_EH_PE_aligned
&& (per_encoding & 0x70) != DW_EH_PE_absptr
&& (per_encoding & 0x70) != DW_EH_PE_aligned
&& (lsda_encoding & 0x70) != DW_EH_PE_absptr
&& (lsda_encoding & 0x70) != DW_EH_PE_aligned))
? 0 : SECTION_WRITE;
}
else
flags = SECTION_WRITE;
named_section_flags (EH_FRAME_SECTION_NAME, flags); named_section_flags (EH_FRAME_SECTION_NAME, flags);
#else
named_section_flags (EH_FRAME_SECTION_NAME, SECTION_WRITE);
#endif
#endif #endif
} }
......
...@@ -3208,16 +3208,18 @@ default_exception_section (void) ...@@ -3208,16 +3208,18 @@ default_exception_section (void)
if (targetm.have_named_sections) if (targetm.have_named_sections)
{ {
int flags; int flags;
#ifdef HAVE_LD_RO_RW_SECTION_MIXING
int tt_format = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/0, /*global=*/1);
flags = (! flag_pic if (EH_TABLES_CAN_BE_READ_ONLY)
|| ((tt_format & 0x70) != DW_EH_PE_absptr {
&& (tt_format & 0x70) != DW_EH_PE_aligned)) int tt_format = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/0, /*global=*/1);
? 0 : SECTION_WRITE;
#else flags = (! flag_pic
flags = SECTION_WRITE; || ((tt_format & 0x70) != DW_EH_PE_absptr
#endif && (tt_format & 0x70) != DW_EH_PE_aligned))
? 0 : SECTION_WRITE;
}
else
flags = SECTION_WRITE;
named_section_flags (".gcc_except_table", flags); named_section_flags (".gcc_except_table", flags);
} }
else if (flag_pic) else if (flag_pic)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment