> -----Original Message----- > From: Richard Guenther [mailto:richard.guent...@gmail.com] > Sent: 01 July 2010 16:13 > To: Bingfeng Mei > Cc: gcc@gcc.gnu.org; Jan Hubicka > Subject: Re: Convert cross reference table to resolution file for LTO > > On Thu, Jul 1, 2010 at 5:02 PM, Bingfeng Mei <b...@broadcom.com> wrote: > > Hi, > > I did some experiments to convert cross-reference table > > to resolution files. Patches are attached and still crude. > > > > The initial idea is to have as little as possible change > > in GNU LD. It turns out that cross reference table doesn't > > always print out definition at the first line. So > > some change is needed there. In addition, offset within > > archive file is also useful. Nonetheless, such changes > > may break existing cref users. Maybe it is better to dump > > to a different file. > > > > Collect2 is modified to convert the enhanced cross-reference > > table to a full resolution file and used it in subsequent > > linking steps. Maybe I can move this part into LD. I am just > > not sure if it is easy to have similar functions in BFD > > as those in libelf. And it will be a much bigger change on > > GNU LD then. > > > > I have tried with small examples, and our mixed C/assembly > > applications. It works well with -flto/-fwhole-program. > > > > Any opinion on this approach? > > Nice. I didn't know of --cref. Btw, the resolution file ideally > should come from the driver like for the -fuse-linker-plugin case. > See > > #define LINK_COMMAND_SPEC "\ > ... > -plugin-opt=-fresolution=%u.res \ > > you'd add that for -flto/-fwhopr as well. I will look at it.
> > What exactly is the ELF handling in collect2 for? Is it only for > archive file offset parsing? It's compile of course would need to > be conditionalized on host ELF support availability. Main purpose is to locate the "index" information for each symbol. I will conditionalize Elf part for sure. > > It would also be a nice thing to get rid of the special symbol > marking LTO files but instead look if some of the common > sections are there (likewise for other supported object formats). > So probably best move that LTO file detection and handling > code into a separate file and share it with the LTO backend code. > Actually, this part is mainly copied from lto-plugin implementation. > Does --cref work with .comm symbols properly (listing the biggest > one first)? Yes, after my patch. The original --cref just prints out all comm symbols. The first one is not necessarily used one. > > Richard. > > > Thanks, > > Bingfeng > >