[PATCH] Add -l option to llvm-link and allow linking by resolving symbols

Mekhanoshin, Stanislav Stanislav.Mekhanoshin at amd.com
Fri Apr 25 11:05:13 PDT 2014


The "smart linking" is not a completely new concept for native linkers, even if library is organized in an archive. A big translation unit may have many symbols with just a few really needed. Even if we change our own libraries we could not stop developers from building large modules. Probably adding this as a mode for core linker would be not a best idea, but having this as a separate tool seems to be a good idea at least for me, especially if we already have this code.

Stas


-----Original Message-----
From: Rafael EspĂ­ndola [mailto:rafael.espindola at gmail.com] 
Sent: Friday, April 25, 2014 9:46 PM
To: reviews+D3459+public+156625a4405c5834 at reviews.llvm.org
Cc: Mekhanoshin, Stanislav; Arsenault, Matthew; llvm-commits
Subject: Re: [PATCH] Add -l option to llvm-link and allow linking by resolving symbols

On 25 April 2014 13:34, Stanislav Mekhanoshin <stanislav.mekhanoshin at amd.com> wrote:
> Changes to llvm-link are really small, most of the code is in the ResolveLinker.cpp. In fact our compiler uses this code for library linking with llvm-link being a secondary tool. Probably other llvm users can use it as well.

This type of logic doesn't belong in lib/Linker. The code in lib/Linker is the most central part of IR linking. The only logic in there should be the one that is needed by all liking paths. That is not the case for any solution using a native linker, since the semantic of all such linkers is to load an entire object file at a time.

Which also brings the question, why do this instead of using an archive? An archive with multiple IR files would let you use the same logic native linkers use and be more efficient.

Cheers,
Rafael




More information about the llvm-commits mailing list