Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!news-xxxfer.readnews.com!news.misty.com!news.iecc.com!nerds-end From: Harald Gustafsson Newsgroups: comp.compilers Subject: Re: combining c-code files into one c-code file Date: Wed, 4 Apr 2012 19:35:25 +0200 Organization: Compilers Central Lines: 33 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <12-04-007@comp.compilers> References: <12-04-005@comp.compilers> NNTP-Posting-Host: news.iecc.com X-Trace: leila.iecc.com 1333653620 14776 64.57.183.58 (5 Apr 2012 19:20:20 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Thu, 5 Apr 2012 19:20:20 +0000 (UTC) Keywords: C, tools Posted-Date: 05 Apr 2012 15:20:20 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:550 Hi Cameron, From what I could find so far the project I'm porting does not use weak symbols, but if such was used then the linking is important if several identical symbols exist. Everything needs to be "linked" statically since it is going to be one file scope, the code I'm converting is one static library. So far I have found two tools that seems to be a good start. The CScout commercial tool, the author has said that all the parts are in the tool, and it could be adapted to also output the complete file scope. This tool handles large projects like the Linux kernel (which I think use weak symbols), but I have not yet verified the correctness of the tool for my libx264 porting. Then I also discovered that a colleague five rooms from me had made such a tool 10 years ago, it basically uses gcc preprocessor then implements a c-parser and rename clashing identifiers and prints them in one file. The purpose was to investigate if the compiler could do a better job when getting one large file scope instead of several. This tool is not as advanced and foolproof as CScout but it has been tested on projects like audio codecs and protocol stacks. It would likely not handle weak symbols, at least not by design. /Harald On 4 apr 2012, at 18.02, Cameron McInally wrote: > Hey Harald, > > No, I do not know of any tool that will do such things automatically. > But, a tool like this is not something that would be on my radar. > > I do have a small bit to add though, which may make such a tool a tall > order. One immediate issue I see is determining linkage of symbols > when consolidating the source. When handling WEAK symbols, ...