Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #550

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

From Harald Gustafsson <harald.gustafsson@gmail.com>
Newsgroups comp.compilers
Subject Re: combining c-code files into one c-code file
Date 2012-04-04 19:35 +0200
Organization Compilers Central
Message-ID <12-04-007@comp.compilers> (permalink)
References <12-04-005@comp.compilers> <CAMRjkV9ru=3cAMZ6GHZNsKn1BsQxo+pnwWR9uQ=uO13UsyK0GQ@mail.gmail.com>

Show all headers | View raw


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

Back to comp.compilers | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

combining c-code files into one c-code file Harald Gustafsson <harald.gustafsson@gmail.com> - 2012-04-03 06:23 -0700
  Re: combining c-code files into one c-code file Cameron McInally <cameron.mcinally@nyu.edu> - 2012-04-04 12:02 -0400
  Re: combining c-code files into one c-code file Harald Gustafsson <harald.gustafsson@gmail.com> - 2012-04-04 19:35 +0200
  Re: combining c-code files into one c-code file Gene <gene.ressler@gmail.com> - 2012-04-09 05:40 -0700
  Re: combining c-code files into one c-code file Harald Gustafsson <harald.gustafsson@gmail.com> - 2012-04-18 02:01 -0700

csiph-web