Messages in this thread | | | From | David Mosberger <> | Date | Thu, 20 May 2004 15:32:02 -0700 | Subject | Re: [PATCH] fixing sendfile on 64bit architectures |
| |
>>>>> On Thu, 20 May 2004 15:25:10 -0700, Andrew Morton <akpm@osdl.org> said:
Andrew> Jesse Barnes <jbarnes@engr.sgi.com> wrote: >> On Thursday, May 20, 2004 5:56 pm, Andrew Morton wrote: > An >> alternative might be to remove all the ifdefs, build with > >> -ffunction-sections and let the linker drop any unreferenced >> code...
>> That would probably be even more confusing than the #ifdefs. At >> least with those you know that you need to check whether the >> current code will be called...
Andrew> Me no understand Jesse.
Andrew> Removing the ifdefs and letting the linker do the job has Andrew> the advantage that the compiler gets to check more code for Andrew> you.
I think he meant that it's easier to see who (what platform) is relying on the code.
Another disadvantage of -ffunction-sections is that the compiler won't be able to do proper inlining. There are several cases where you have:
static do_the_work () { ... }
asmlinkage long sys_one_variant () { do_the_work(some args...); }
asmlinkage long sys_other_variant () { do_the_work(other args...); }
If only one variant is needed, GCC 3.4 will automatically inline "do_the_work()" (since there is only one call-site), which is exactly what you want. You won't get that with -ffunction-sections.
--david - 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/
| |