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: [i386] Support .lbss etc. sections with Solaris as (PR target/59407)


Uros Bizjak <ubizjak@gmail.com> writes:

> On Thu, Mar 17, 2016 at 11:40 PM, Rainer Orth
> <ro@cebitec.uni-bielefeld.de> wrote:
>> gcc.target/i386/pr58218.c currently FAILs on 64-bit Solaris/x86 with the
>> native assembler:
>>
>> FAIL: gcc.target/i386/pr58218.c (test for excess errors)
>>
>> Excess errors:
>> Assembler: pr58218.c
>>         "/var/tmp//cciHFIO7.s", line 3 : Section attributes do not match
>>
>>         .section        .lbss,"aw",@nobits
>>
>> It turns out x86_64 large sections need to marked with a 'h' section
>> flag for as.  gas implicitly sets SHF_AMD64_LARGE based on section
>> names, but also accepts an 'l' for the same purpose.
>>
>> The following patch fixes this by using the SECTION_MACH_DEP section
>> flag to mark large sections and emit the right flag in
>> default_elf_asm_named_section.
>>
>> Given this comment in output.h
>>
>> #define SECTION_MACH_DEP 0x4000000 /* subsequent bits reserved for target
>> */
>>
>> handling only a single SECTION_MACH_DEP can be considered a hack.
>> Currently, only one user of SECTION_MACH_DEP (avr) uses more than one
>> section flag, so maybe I can get away with this for now.
>>
>> A full solution would split out the part of
>> default_elf_asm_named_section that emits the flags into a new
>> default_elf_asm_section_flags which prints the flag string to a stream,
>> invoking it either via a macro than be overridden or perhaps a target
>> hook (which seems not fully right either since those are object file
>> format agnostic and this is just a small part of emitting ELF named
>> sections).
>>
>> The patch has been bootstrapped without regressions on
>> i386-pc-solaris2.12 (with both as and gas) and x86_64-pc-linux-gnu.
>> This is not a regression, so this may have to wait for GCC 7 stage 1.
>>
>> Ok for mainline now or then?
>
> I'd rather leave this and subsequent patch for gcc-7 at this point.
> The patch touches middle-end, and from the explanation above, it looks
> that some discussion with middle-end maintainers (relevant people
> CC'd) and their approval  is still needed.

Understood.  It would be good if they could chime in so I know if the
patch is acceptable in principle or needs considerable rework.

Thanks.
        Rainer


>> 2016-03-15  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
>>
>>         PR target/59407
>>         * config/i386/i386.c (SECTION_LARGE): Define.
>>         (x86_64_elf_select_section): Set it for large data/bss sections.
>>         Only clear SECTION_WRITE for .lrodata.
>>         (x86_64_elf_section_type_flags): Set SECTION_LARGE for large
>>         data/bss sections.
>>         * config/i386/sol2.h (MACH_DEP_SECTION_ASM_FLAG): Define.
>>         * varasm.c (default_elf_asm_named_section): Grow flagchars.
>>         [MACH_DEP_SECTION_ASM_FLAG] Emit MACH_DEP_SECTION_ASM_FLAG for
>>         SECTION_MACH_DEP.
>>         * doc/tm.texi.in (Sections, MACH_DEP_SECTION_ASM_FLAG): Describe.
>>         * doc/tm.texi: Regenerate.
>>
>>
>>
>> --
>> -----------------------------------------------------------------------------
>> Rainer Orth, Center for Biotechnology, Bielefeld University
>>

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


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