empty function optimizations
Ken Clark
ken@gesn.com
Wed Jul 12 13:43:00 GMT 2000
> From: Martin v. Loewis [ mailto:martin@loewis.home.cs.tu-berlin.de ]
> Sent: Wednesday, July 12, 2000 11:58 AM
>
> "erase__t4list2Z3fooZt24__default_alloc_template2b1i0Gt15__list_it
erator3Z3f
> > ooZR3fooZP3fooT1:" and its baz counterpart. They are line for line
> > identical.
>
> Ok. But I understood your proposal was to have the linker look at the
> object files, so I assembled your file. Doing objdump -h duplicate.o
> |grep erase, I got
Damn. I screwed up: I see now there is one line different in the asm too.
Sorry. Honestly I wasn't trying to pull a fast one.
> Looks similar, right? Unfortunately, it's not identical. Looking at
> the fourth line (offset 0030), you'll see a1040000 in one case and
> a1080000. So your strategy for combining them would fail here.
Conceded. Of course this is the part where I say "this was a bad example".
I can make up some examples if you insist, but really the only way to see if
this is worth while is to write a util to look for duplicates in real code.
I don't know enough about ld internals to actually do a real merge, but I
should be able to write something to parse through objdump output and
generate some stats.
Maybe I am wrong. It will be interesting to run vmlinux through it. There
were three copies of zlib in the kernel source last time I checked :-).
Ken
More information about the Gcc
mailing list