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] PowerPC section type conflict


Hi, under powerpc targets, using -mrelocatable under some cases triggers
an error during final assembly generation: rs6000_assemble_integer()
calls varasm.c:unlikely_text_section_p(), and the call chain eventually
gets to where the section htab is queried for ".text.unlikely", and
fails because of mismatched section flags: "error: foo causes a section
type conflict"

This seems to happen after rev.167085, 4.6 branch is also affected.

The flag mismatch seems quite straightforward: current_function_decl is
passed in as the decl here, and as it's final assembly now, it is
NULL_TREE. varasm.c:default_section_type_flags() adds SECTION_WRITE to
its return value, and things get borked.

This patch simply adds a condition to the SECTION_CODE case, to include
when decl == NULL_TREE, and the queried section has a .text* name. I
think this should be the intuitive way, and it does allow the testcase
to compile.

Tested on a powerpc target, is this okay for trunk? (and maybe 4.6 too?)

Thanks,
Chung-Lin

2011-12-16  Chung-Lin Tang  <cltang@codesourcery.com>

	gcc/
	* varasm.c (default_section_type_flags): Set SECTION_CODE in
	flags when decl is NULL_TREE, and section name matches ".text*".

Attachment: varasm.diff
Description: Text document


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