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]

Re: [PATCH] PowerPC section type conflict


On 2011/12/17 06:21 AM, Richard Henderson wrote:
> On 12/16/2011 03:16 AM, Chung-Lin Tang wrote:
>> 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.
> 
> I don't understand what was put into .text.unlikely that was not a
> function in the first place?  Did we try to put data there somewhere?

I don't think it's that kind of problem; the powerpc backend uses
unlikely_text_section_p(), which compares the passed in argument section
and the value of function_section_1(current_function_decl,true).

Since current_function_decl is NULL at assembly phase, it retrieves
".text.unlikely" to test for equality. It's the retrieving/lookup that
fails here, because the default looked-up section flags set when decl ==
NULL does not really seem to make sense (adds SECTION_WRITE).

Chung-Lin


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