Re: [PATCH] pci/msi: Use #ifdefs instead of weak functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2009-01-18 at 20:39 -0800, Greg KH wrote:
> On Mon, Jan 19, 2009 at 12:07:04PM +1100, Michael Ellerman wrote:
> > Weak functions aren't all they're cracked up to be. They lead to
> > incorrect binaries with some toolchains, they require us to have empty
> > functions we otherwise wouldn't, and the unused code is not elided
> > (as of gcc 4.3.2 anyway).
> > 
> > So replace the weak MSI arch hooks with the #define foo foo idiom. We no
> > longer need empty versions of arch_setup/teardown_msi_irq().
> > 
> > This is less source (by 1 line!), and results in smaller binaries too:
> > 
> >    text	   data	    bss	    dec	    hex	filename
> > 9354300	1693916	 678424	11726640 b2ef30	build/powerpc/vmlinux-before
> > 9354052	1693852	 678424	11726328 b2edf8	build/powerpc/vmlinux-after
> > 
> > Also smaller on x86_64 and arm (iop13xx).
> 
> Ick, no, I wanted to use weak functions for these instead of ifdefs as I
> thought that was what was preferred.

So did I, but in this case the #ifdefs are simpler and less code.

> Can't we just fix the toolchains?

The out-and-out bugs have been fixed by the sound of it, and I didn't
know we'd black-listed the bad compilers, but that's good too.

But even then, in this case using weak functions means we need two empty
functions we otherwise wouldn't, and we end up with dead code in the
resulting binary.

The latter makes it harder to spot things like the fact that we
currently have a completely dead version of arch_setup_msi_irq() on x86.
Harder because there is a call to that routine in the vmlinux, but it's
never called because it's part of the weak function that has been
overridden.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux