* GCC-4.0.2 20050811: should GCC consider inlining functions in between different sections?
@ 2005-08-12 10:40 Etienne Lorrain
2005-08-12 11:07 ` Richard Guenther
0 siblings, 1 reply; 6+ messages in thread
From: Etienne Lorrain @ 2005-08-12 10:40 UTC (permalink / raw)
To: gcc
Hello,
Subject says it all - I do not know if that is new. I just have a bug
in Gujin-1.2 with this new compiler, because function:
__attribute__ ((section (".xcode_start"), noreturn))
void xcodeseg_never_call_address_zero (void)
calls xcodeseg_BOOT1_putstr() generated by macro:
#define GENERATE_VOID_EXTRA2CODE_INDIRECT_STUB(fctname, fctadr, params...) \
__attribute__ ((section (STRING(.Xxcode2text_ ## fctname)))) \
void xcodeseg_ ## fctname (params) { \
EXTRASEG_REVERSE_STUB (fctadr, STRING(.Xtext2xcode_ ## fctname));\
}
Adding ", noinline" to the attribute list fix it all, I just was wondering
if inlining in between GCC sections is safe in the general case.
Etienne.
___________________________________________________________________________
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
Téléchargez cette version sur http://fr.messenger.yahoo.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: GCC-4.0.2 20050811: should GCC consider inlining functions in between different sections?
2005-08-12 10:40 GCC-4.0.2 20050811: should GCC consider inlining functions in between different sections? Etienne Lorrain
@ 2005-08-12 11:07 ` Richard Guenther
2005-08-12 12:06 ` Etienne Lorrain
0 siblings, 1 reply; 6+ messages in thread
From: Richard Guenther @ 2005-08-12 11:07 UTC (permalink / raw)
To: Etienne Lorrain; +Cc: gcc
On 8/12/05, Etienne Lorrain <etienne_lorrain@yahoo.fr> wrote:
> Hello,
>
> Subject says it all - I do not know if that is new. I just have a bug
> in Gujin-1.2 with this new compiler, because function:
>
> __attribute__ ((section (".xcode_start"), noreturn))
> void xcodeseg_never_call_address_zero (void)
>
> calls xcodeseg_BOOT1_putstr() generated by macro:
>
> #define GENERATE_VOID_EXTRA2CODE_INDIRECT_STUB(fctname, fctadr, params...) \
> __attribute__ ((section (STRING(.Xxcode2text_ ## fctname)))) \
> void xcodeseg_ ## fctname (params) { \
> EXTRASEG_REVERSE_STUB (fctadr, STRING(.Xtext2xcode_ ## fctname));\
> }
>
> Adding ", noinline" to the attribute list fix it all, I just was wondering
> if inlining in between GCC sections is safe in the general case.
Please explain the problem you're seeing. I can see nothing wrong with inlining
functions within different sections in general. If you're trying to
do things behind
the compilers back, though, be prepared to change workarounds with compiler
versions.
Richard.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: GCC-4.0.2 20050811: should GCC consider inlining functions in between different sections?
2005-08-12 11:07 ` Richard Guenther
@ 2005-08-12 12:06 ` Etienne Lorrain
2005-08-12 17:10 ` Mike Stump
2005-08-16 8:15 ` Segher Boessenkool
0 siblings, 2 replies; 6+ messages in thread
From: Etienne Lorrain @ 2005-08-12 12:06 UTC (permalink / raw)
To: Richard Guenther; +Cc: gcc
--- Richard Guenther <richard.guenther@gmail.com> wrote:
> Please explain the problem you're seeing. I can see nothing wrong with
> inlining functions within different sections in general. If you're
> trying to do things behind the compilers back, though, be prepared to
> change workarounds with compiler versions.
For my project, i.e. Gujin on sourceforge, I am putting some sections
in one place, some other in another place, and the relation in between
sections has to be tightly controlled. For instance in Gujin, section
names decides on which i386 code segment the code will be put - so that
if you want to reference some symbols in another code section you have
to do the equivalent of a far code instead of a near call.
I have added a command to the linker file to forbid reference from
one section to another:
NOCROSSREFS (.text .xcode);
so that I can catch the unexpected use at link time. The inter-segment
references have to be in some special sections - using some out-of-line
functions.
Inlining those special functions makes a symbol reference from a section
name appear in another - in this special case my software would still
work when the "NOCROSSREFS (.text .xcode);" is commented out.
The question is in fact: what is a section for GCC? Is it just a way to
group functions together to improve memory cache efficiency; or is the
GCC user authorised to use sections to forbid access to some functions
at link time?
Is there a third use of sections I am not aware of? (excluding function
sections for LD garbage collection of section, which is quite an
orthogonal problem).
Thanks for information,
Etienne.
___________________________________________________________________________
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
Téléchargez cette version sur http://fr.messenger.yahoo.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: GCC-4.0.2 20050811: should GCC consider inlining functions in between different sections?
2005-08-12 12:06 ` Etienne Lorrain
@ 2005-08-12 17:10 ` Mike Stump
2005-08-12 17:27 ` Jan Hubicka
2005-08-16 8:15 ` Segher Boessenkool
1 sibling, 1 reply; 6+ messages in thread
From: Mike Stump @ 2005-08-12 17:10 UTC (permalink / raw)
To: Etienne Lorrain; +Cc: Richard Guenther, gcc
On Aug 12, 2005, at 5:05 AM, Etienne Lorrain wrote:
> I have added a command to the linker file to forbid reference from
> one section to another:
> NOCROSSREFS (.text .xcode);
It sounds like this feature isn't compatible with inlining, -fno-
inline I suspect is one of the few ways to `fix' it in general, that,
or require that all functions be marked noinline that would otherwise
be wrong to inline.
> The question is in fact: what is a section for GCC?
Anything a user wants. We don't limit the uses, so this question
cannot, in general be answered, at best a few users could tell you
how a few of them are using sections. For example, I would not
expect most people to know about NOCROSSREFS.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: GCC-4.0.2 20050811: should GCC consider inlining functions in between different sections?
2005-08-12 17:10 ` Mike Stump
@ 2005-08-12 17:27 ` Jan Hubicka
0 siblings, 0 replies; 6+ messages in thread
From: Jan Hubicka @ 2005-08-12 17:27 UTC (permalink / raw)
To: Mike Stump; +Cc: Etienne Lorrain, Richard Guenther, gcc
> On Aug 12, 2005, at 5:05 AM, Etienne Lorrain wrote:
> > I have added a command to the linker file to forbid reference from
> > one section to another:
> >NOCROSSREFS (.text .xcode);
>
> It sounds like this feature isn't compatible with inlining, -fno-
> inline I suspect is one of the few ways to `fix' it in general, that,
-fno-inline still won't suppress inlining of functions called once...
Honza
> or require that all functions be marked noinline that would otherwise
> be wrong to inline.
>
> > The question is in fact: what is a section for GCC?
>
> Anything a user wants. We don't limit the uses, so this question
> cannot, in general be answered, at best a few users could tell you
> how a few of them are using sections. For example, I would not
> expect most people to know about NOCROSSREFS.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: GCC-4.0.2 20050811: should GCC consider inlining functions in between different sections?
2005-08-12 12:06 ` Etienne Lorrain
2005-08-12 17:10 ` Mike Stump
@ 2005-08-16 8:15 ` Segher Boessenkool
1 sibling, 0 replies; 6+ messages in thread
From: Segher Boessenkool @ 2005-08-16 8:15 UTC (permalink / raw)
To: Etienne Lorrain; +Cc: gcc, Richard Guenther
> The question is in fact: what is a section for GCC? Is it just a way
> to
> group functions together to improve memory cache efficiency; or is the
> GCC user authorised to use sections to forbid access to some functions
> at link time?
For user-declared ("attribute") sections, GCC just outputs
the necessary assembler magic, and that's it. Anything else
is handled by your binary format tools, if at all.
Segher
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-08-16 8:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-12 10:40 GCC-4.0.2 20050811: should GCC consider inlining functions in between different sections? Etienne Lorrain
2005-08-12 11:07 ` Richard Guenther
2005-08-12 12:06 ` Etienne Lorrain
2005-08-12 17:10 ` Mike Stump
2005-08-12 17:27 ` Jan Hubicka
2005-08-16 8:15 ` Segher Boessenkool
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).