Messages in this thread | | | Date | Thu, 5 Jan 2006 23:55:13 +0100 | From | Ingo Molnar <> | Subject | Re: [patch 00/2] improve .text size on gcc 4.0 and newer compilers |
| |
* Matt Mackall <mpm@selenic.com> wrote:
> > I don't believe it is actually all _that_ volatile. Yes, it would be a > > huge issue _initially_, but the incremental effects shouldn't be that big, > > or there is something wrong with the approach. > > No, perhaps not. But it would be nice in theory for people to be able > to do things like profile their production system and relink. And > having to touch hundreds of files to do it would be painful.
we can (almost) do that: via -ffunction-sections. It does seem to work on both the gcc and the ld side. [i tried to use this for --gc-sections to save more space, but that ld option seems unstable, i couldnt link a bootable image. -ffunction-sections itself seems to work fine in gcc4.]
i think all that is needed to reorder the functions is a build-time generated ld script, which is generated off the 'popularity list'.
so i think the two concepts could nicely co-exist: in-source annotations help us maintain the popularity list, -ffunction-sections allows us to reorder at link time. In fact such a kernel could be shipped in 'unlinked' state, and could be relinked based on per-system profiling data. As long as we have KALLSYMS, it's not even a big debuggability issue.
the branch-likelyhood thing is a separate issue from function-cohesion, but could be handled by the same concept: if there was a --ffunction-unlikely-sections option in gcc (there's none currently, AFAICS), then those could be reordered in a smart way too. (We wouldnt get the 8-byte relative jumps back though, gcc would always have to assume that the jump is far away.)
Ingo - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |