GAS doesn't pass sections like GCC?
Doug Evans
dje@transmeta.com
Thu Jan 16 21:31:00 GMT 2003
Dan Fowell writes:
> Good call Rick! I found that my inline asm without the C function yielded
> the following in my main object file (before linking):
> 8 .vect 000000a0 00000000 00000000 00035eb0 2**0
> CONTENTS, RELOC, READONLY
>
> But when inside the C function I got:
> 8 .vect 000000d4 00000000 00000000 00035f40 2**2
> CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
>
> Does anyone know how to change the attributes of a section from within my
> inline asm statement? Does .section have any flags I can flip?
The standard way to determine this is to pass -S to gcc, study the .s file,
and see what gcc generates (it's a standard way to answer a plethora of
questions like this).
> Here's that asm snippet again:
> __asm__ ("
> .global _isr
> _isr:
> .section .vect
> [Interrupt Handler]
> ");
>
> Also this asm statement is just floating in my C file. Is that OK?
The problem is you've switched the section behind gcc's back.
As long as there aren't any subsequent functions in the file
or you switch the section back or you do something that causes
gcc to have to explicitly switch the section, you're ok.
> Or is
> there a better way besides having a separate asm file or putting it within a
> C function?
I don't think there's necessarily a "better" way.
One caveat though. Embedded newlines in strings are flagged by newer gcc's.
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
More information about the crossgcc
mailing list