[PATCH] XCOFF select section tweak
Richard Henderson
rth@redhat.com
Wed Sep 11 17:44:00 GMT 2002
On Wed, Sep 11, 2002 at 01:42:45PM -0400, David Edelsohn wrote:
> ! unsigned int align;
> ! unsigned int flags = default_section_type_flags_1 (decl, name, reloc, 1);
> !
> ! /* Align to at least UNIT size. */
> ! if (flags & SECTION_CODE)
> ! align = MIN_UNITS_PER_WORD;
> ! else
> ! /* Increase alignment of large objects if not already stricter. */
> ! align = MAX ((DECL_ALIGN (decl) / BITS_PER_UNIT),
> ! int_size_in_bytes (TREE_TYPE (decl)) > MIN_UNITS_PER_WORD
> ! ? UNITS_PER_FP_WORD : MIN_UNITS_PER_WORD);
> !
> ! return flags | (exact_log2 (align) & SECTION_ENTSIZE);
This won't work.
You'll generate an error for
double d __attribute__((section("foo"));
char c __attribute__((section("foo"));
because the alignment of the two decls is different, which will
result in two different flags settings, which will fail the
check in set_named_section_flags.
Currently there is no way to know beforehand what the maximum
alignment for a section will be. If you absolutely positively
need to know this the first time you enter a section, you'll
have to emit assembly in multiple parts. See iris6_asm_file_end
for the bletcherous details of this scheme.
r~
More information about the Gcc-patches
mailing list