This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] SHF_MERGE support for gcc (take 4)
On Mon, Sep 10, 2001 at 10:15:15AM -0700, Richard Henderson wrote:
> On Mon, Sep 10, 2001 at 05:37:07PM +0200, Jakub Jelinek wrote:
> > Bootstrapped on i386-redhat-linux, one regression (buggy testcase
> > execute/20000801-4.c).
>
> The test case is not buggy. How are you treating, say, "\0\0"?
> It should be the same. I suspect that strings with embedded
> nulls simply cannot be merged.
My fault, I realized this too. I remembered this from when 20000801-4.c used to
fail and SHF_MERGE patch actuall made it XPASS or something like that.
Working on a fix.
> > + /* Align the location counter as required by EXP's data type. */
> > + align = TYPE_ALIGN (TREE_TYPE (exp));
> > +#ifdef CONSTANT_ALIGNMENT
> > + align = CONSTANT_ALIGNMENT (exp, align);
>
> -Os should ignore extra alignment.
This was just code move, but I can certainly kill it for -Os.
> > + echo '.section .rodata.str, "ams", @progbits, 1' > conftest.s
>
> "s"? That means short data on a number of targets...
Does it?
When I was adding this support to gas, the only port which was using
md_elf_section_letter was ppc (letter 'e'), rechecking now i370 uses 'e'
too.
Other than that obj-elf.c handles 'a' for SHF_ALLOC, 'w' for SHF_WRITE, 'x'
for SHF_EXECINSTR, 'm' for SHF_MERGE and 's' for SHF_STRINGS.
> > #undef EXTRA_SECTIONS
> > +#ifdef HAVE_GAS_SHF_MERGE
> > +#define EXTRA_SECTIONS in_const, \
> > + in_const_cst1, in_const_cst2, in_const_cst4, \
>
> No, just use named_section_flags. This should go in varasm.c
> and not replicated in all relevant target headers.
Will try.
> > + switch (align) \
> > + { \
> > + case 8: in = in_const_cst1; break; \
> > + case 16: in = in_const_cst2; break; \
> > + case 32: in = in_const_cst4; break; \
> > + case 64: in = in_const_cst8; break; \
> > + case 128: in = in_const_cst16; break; \
>
> What about an object larger than its alignment? Won't merging
> wind up treating it as two objects?
GET_MODE_BITSIZE (mode) <= align should catch that.
Jakub