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 -fPIC on ppc-*-linux*


Hi!

-fPIC seems to be quite broken on ppc, it makes all sections writeable
(with the exception of sections which don't use .section), which
for sections like .gnu.linkonce.r.* or .gnu.linkonce.t.* is very bad,
given where they are present in the linker script.
As binutils for ppc-*-linux* unconditionally /DISCARD/ .fixup sections
anyway, I don't see the point in generating them at all on ppc-*-linux*.
The following patch does that and only limits making all sections writeable
(which is IMHO still wrong) to other platforms.
Ok to commit?

For the rest of platforms, can somebody show me example of section for which
default_section_type_flags_1 (decl, name, reloc, flag_pic || DEFAULT_ABI == ABI_AIX);
would not set SECTION_WRITE yet it would need to be writeable for fixups?
IMHO then reloc should be non-zero and thus the section writeable too, and
if not, it should be dealt with it somewhere else, so that proper name
of the section reflecting its writeability is used as well.

2003-01-29  Jakub Jelinek  <jakub@redhat.com>

	* config/rs6000/linux.h (RELOCATABLE_NEEDS_FIXUP): Undefine.
	* config/rs6000/rs6000.c (rs6000_elf_section_type_flags): Make all
	sections writeable only if RELOCATABLE_NEEDS_FIXUP is defined.

--- gcc/config/rs6000/linux.h.jj	2003-01-28 11:59:11.000000000 -0500
+++ gcc/config/rs6000/linux.h	2003-01-29 07:48:25.000000000 -0500
@@ -79,6 +79,9 @@ Boston, MA 02111-1307, USA.  */
 #undef DRAFT_V4_STRUCT_RET
 #define DRAFT_V4_STRUCT_RET 1
 
+/* We don't need to generate entries in .fixup.  */
+#undef RELOCATABLE_NEEDS_FIXUP
+
 /* Do code reading to identify a signal frame, and set the frame
    state data appropriately.  See unwind-dw2.c for the structs.  */
 
--- gcc/config/rs6000/rs6000.c.jj	2003-01-28 16:25:44.000000000 -0500
+++ gcc/config/rs6000/rs6000.c	2003-01-29 07:56:35.000000000 -0500
@@ -13005,8 +13005,10 @@ rs6000_elf_section_type_flags (decl, nam
     = default_section_type_flags_1 (decl, name, reloc,
 				    flag_pic || DEFAULT_ABI == ABI_AIX);
 
+#ifdef RELOCATABLE_NEEDS_FIXUP
   if (TARGET_RELOCATABLE)
     flags |= SECTION_WRITE;
+#endif
 
   return flags;
 }

	Jakub


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