[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] TCC and "smart" linking

From: Oleg N. Cher
Subject: Re: [Tinycc-devel] TCC and "smart" linking
Date: Thu, 11 Oct 2012 13:14:57 +0300
User-agent: Thunderbird (Windows/20081209)

Thank you for words of wisdom that Milutin Jovanović said.

2 Jared Maddox: I do not acts as domineering screamer.
I just unpleasantly surprised that the thing that should be in the compiler is perceived by someone as an optional extra feature. And the reducing size of a compiler and wish to have fast compilation are called as obstacles and reasons not to implement smart linking. But all that I suggest is to increase *average* compilation speed more. And do you want to be offended by me or assist to give themselves and others a good compiler?

Do you know Total Commander by /Christian Ghisler? /It is very powerful and widely functional product which is able to many possibilities. Its author is not specifically to save the code size, but the size of distribution is about 2 megabytes. I believe, if it was from Microsoft, it would have occupied 300-500 Mb. TCC may be the same strategy - balance between usefulness and itself code size.

Milutin Jovanović wrote:

I am little surprised that the tone of this thread has turned negative. It is really not clear what the argument is about. Peoples preferences?

I cannot imagine that marking symbols as referenced to be expensive... If it was as simple as not outputting into target executable symbols that are not marked as used, this would be a truly simple task. And fast, while we're on it. However, the problem arises when linking with libraries, which is already compiled code. When including a symbol from a library, a mechanism needs to be created to determine which symbols this routine references, and then recursively repeat the process. I admit that I am not expert on binary and library formats... The only way I can think of doing this is to examine relocation tables, and hopefully extract/deduce this information from it. However I don't know if this is even possible. So, this could be a non trivial and not so fast operation.
I'm sure all is not so bad. I've used SDCC (Small Device C Compiler). It provides this model of behavior. A linker *does not include all of the specified libraries into the target code directly*, and searching for previously compiled functions and variables (by name) in a library just as long as there will not be eliminated all dependences. Do you think that this behavior cannot be implemented using object files format of TCC?

Regarding the comparison to Turbo Pascal, if I remember correctly, they used their own library format, and it might contain this dependency information that can be used to quickly eliminate unused code. tcc however needs to use standard formats.

All in all, the problem does not seem trivial, and is made worse by the fact that it needs to work with multiple file formats/platform. Judging by activity of this project, it seems little ambitious.

Initially, even the TP library does not know the essence of what it will need in the target program, which will need to link. Just all of the procedures and variables aren't placed in the libraries as a single piece of code, but as entities that can be given out by one atomically. Now TCC uses standard formats? Probably the formats might to support this behavior, and it's all we need for implementing the smart linking...

Oleg N. Cher,
VEDAsoft Oberon Club

reply via email to

[Prev in Thread] Current Thread [Next in Thread]