From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Lance Taylor To: lefurgy@eecs.umich.edu Cc: binutils@sourceware.cygnus.com Subject: Re: reordering procedures Date: Mon, 18 Oct 1999 12:49:00 -0000 Message-id: <19991018194824.16905.qmail@daffy.airs.com> References: <199910162308.TAA08906@noey.eecs.umich.edu> X-SW-Source: 1999-10/msg00101.html Date: Sat, 16 Oct 1999 19:08:10 -0400 From: Charles Lefurgy I'm doing some code layout experiments. I would like to use binutils (BFD) to re-order procedures in a binary executable (mips-coff). Is it even possible? If so, is there an easy way to do this? What are the steps involved? What about relocations? You can reorder sections easily enough--the linker script language permits you to do that in various ways--but you can not in general reorder procedures within a single section. In certain specific cases it may be possible. However, BFD will not help you very much. I assume that by mips-coff you mean ECOFF. ECOFF is a poor choice for this sort of work because it does not permit arbitrary sections. I recommend using ELF, and the gcc -ffunction-sections option to put each function in a different section. It will then be more or less straightforward to generate a linker script which puts the sections in whatever order you like. Ian