This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: empty function optimizations
- To: ken at gesn dot com
- Subject: Re: empty function optimizations
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Wed, 12 Jul 2000 20:57:57 +0200
- CC: gcc at gcc dot gnu dot org
- References: <NCBBIGGNCKBDKCCGPEOAOEDODKAA.ken@gesn.com>
> Attached is a STL example that calls the list::operator=() function. Take a
> look at
> "erase__t4list2Z3fooZt24__default_alloc_template2b1i0Gt15__list_iterator3Z3f
> 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
18 .gnu.linkonce.t.erase__t4list2Z3fooZt24__default_alloc_template2b1i0Gt15__list_iterator3Z3fooZR3fooZP3fooT1 0000006f 00000000 00000000 00000880 2**4
21 .gnu.linkonce.t.erase__t4list2Z3barZt24__default_alloc_template2b1i0Gt15__list_iterator3Z3barZR3barZP3barT1 0000006f 00000000 00000000 00000a60 2**4
Same size, different virtual addresses. Now look at the contents
(objdump -j .gnu.some-section-name --full-contents duplicate.o)
Contents of section .gnu.linkonce.t.erase__t4list2Z3fooZt24__default_alloc_template2b1i0Gt15__list_iterator3Z3fooZR3fooZP3fooT1:
0000 5589e583 ec0c5756 538b7d10 8b17eb45 U.....WVS.}....E
0010 8955f48b 02890789 55f88b32 8b420489 .U......U..2.B..
0020 30894604 8b5df868 00000000 e8fcffff 0.F..].h........
0030 ff83c404 a1040000 00890389 1d040000 ................
0040 00680000 0000e8fc ffffff83 c4048975 .h.............u
0050 fc8b0789 c28b4d14 8b0139c2 75b28b4d ......M...9.u..M
0060 08890189 c88d65e8 5b5e5fc9 c20400 ......e.[^_....
Contents of section .gnu.linkonce.t.erase__t4list2Z3barZt24__default_alloc_template2b1i0Gt15__list_iterator3Z3barZR3barZP3barT1:
0000 5589e583 ec0c5756 538b7d10 8b17eb45 U.....WVS.}....E
0010 8955f48b 02890789 55f88b32 8b420489 .U......U..2.B..
0020 30894604 8b5df868 00000000 e8fcffff 0.F..].h........
0030 ff83c404 a1080000 00890389 1d080000 ................
0040 00680000 0000e8fc ffffff83 c4048975 .h.............u
0050 fc8b0789 c28b4d14 8b0139c2 75b28b4d ......M...9.u..M
0060 08890189 c88d65e8 5b5e5fc9 c20400 ......e.[^_....
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.
Regards,
Martin