SRI-CSL / OCCAM

OCCAM: Object Culling and Concretization for Assurance Maximization
BSD 3-Clause "New" or "Revised" License
26 stars 10 forks source link

Possible linking error when duplicate function names #12

Closed caballa closed 6 years ago

caballa commented 7 years ago

This problem has been introduced recently in commit 8a9fc2c52f95a29d5a9ef4332880cf1c6717e18d.

If we try to specialize a callsite in module m1 that calls a function defined in module m2 where one of the actual parameters is a pointer to function foo (defined in m1), then foo can become dead in m1. However, foo can be called from m2 but if foo is removed from m1 then the linker will raise an error.

There are function attributes like OptimizeNone that in principle can avoid a function to be optimized but LLVM passes do not necessarily consider it. In fact, DCE doesn't. Instead, the solution was to mark foo as external. Unfortunately, this works only if there is not another function with same name foo in m2. In that case, we will get a linking error.

I need to find a proper solution.

caballa commented 6 years ago

I'll close it for now since this problem only shows up in one of the (unused) branches.