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: RFC: Preserving order of functions and top-level asms via cgraph


On Sun, Apr 10, 2005 at 06:12:53PM -0700, Mark Mitchell wrote:
> What I'd like to know is why these users are using the option, so that 
> we can see if we think those uses are reasonable.
> 
> If we simply take the position that we can't break existing code, then 
> we certainly can't do what I'm suggesting.  In general, we certainly 
> don't want to break existing code, but maybe if we look at the examples, 
> we'll decide we don't mind.  On the other hand, maybe we'll decide 
> they're valid.  Or, maybe we'll decide that there are so many examples 
> that breaking the code is a bad idea, even if each individual example is 
> a disgusting hack.

I assume that last bit is true.  I'd need to see a pretty persuasive
argument otherwise.  Put it this way:

  - GCC uses it
  - glibc uses it
  - the Linux kernel uses it
  - those are the system-level components that I am most familiar with;
    newlib/libgloss don't, but three out of four that I checked isn't
    too shabby.

Glibc uses it for a couple of things, including sedding compiler
output, though I am not exactly sure why.  Linux uses are too varied to
summarize.

> There might also be better ways to do the things that people are 
> currently doing, so that we could break existing code, but provide a 
> useful workaround.  For example, we could add an asm_before function 
> attribute that contained literal assembly code to be emitted directly 
> before the function.  That might serve the MIPS kernel needs, in a 
> cleaner way than the current implicit ordering constraint.  A further 
> advantage would be that if, say, the compiler could prove the function 
> unused (which will not be the case in the situation you describe), then 
> the assembly code would never be emitted.  Right now, we might get in 
> trouble if the assembly fragment were emitted, but the function elided.

No, we wouldn't; it's a "function" itself, it would never be called. 
Besides, I doubt anyone ever does this without using global functions
or attribute((__used__)).

-- 
Daniel Jacobowitz
CodeSourcery, LLC


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