[cfe-dev] [RFC] clang-ifso: A new clang-based tool for generating interface libraries.

David Chisnall via cfe-dev cfe-dev at lists.llvm.org
Tue Apr 9 04:53:37 PDT 2019


On 09/04/2019 10:06, Jake Ehrlich via cfe-dev wrote:
> 1) Producing from headers: This let's you build the .tbe file and/or 
> stub before anything is compiled or linked. It however requires you to 
> keep track of headers which is slightly complicated or verbose depending 
> nonnhow you do it. It also requires reparsing everything. Further still 
> you have to make sure you have all the same flags and you also have to 
> make lots.of assumptions about the linker. It's basically very redundant 
> and requires a lot of matching of behavior of the compiler and linker. 
> Also keep in mind that you can at most match the behavior of 1 compiler 
> and 1 linker. They're similar but not exactly the same and there are 4 
> major combinations of these things between GNU and llvm. Also keep in 
> mind that in general you actually need to use arbitrary source nfiles 
> not just headers files.

Even in a very clean library, headers do not typically contain symbol 
versions and so a .so file created from the headers will not give a 
version that you can link against and have a binary that works with the 
real library.  At a minimum, you'd need to also parse version scripts.

That said, I can see the utility of a tool that compares the symbols 
exported from a library with the interfaces declared in the public 
headers and warns you if you're leaking private interfaces across a .so 
boundary.

David


More information about the cfe-dev mailing list