Re: combining c-code files into one c-code file

Harald Gustafsson <harald.gustafsson@gmail.com>
Wed, 4 Apr 2012 19:35:25 +0200

          From comp.compilers

Related articles
combining c-code files into one c-code file harald.gustafsson@gmail.com (Harald Gustafsson) (2012-04-03)
Re: combining c-code files into one c-code file cameron.mcinally@nyu.edu (Cameron McInally) (2012-04-04)
Re: combining c-code files into one c-code file harald.gustafsson@gmail.com (Harald Gustafsson) (2012-04-04)
Re: combining c-code files into one c-code file gene.ressler@gmail.com (Gene) (2012-04-09)
Re: combining c-code files into one c-code file harald.gustafsson@gmail.com (Harald Gustafsson) (2012-04-18)
| List of all articles for this month |
From: Harald Gustafsson <harald.gustafsson@gmail.com>
Newsgroups: comp.compilers
Date: Wed, 4 Apr 2012 19:35:25 +0200
Organization: Compilers Central
References: 12-04-005 <CAMRjkV9ru=3cAMZ6GHZNsKn1BsQxo+pnwWR9uQ=uO13UsyK0GQ@mail.gmail.com>
Keywords: C, tools
Posted-Date: 05 Apr 2012 15:20:20 EDT

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, ...



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.