Link Time Symbol Type Checking

Suprateeka R Hegde hegdesmailbox@gmail.com
Fri Jan 1 00:00:00 GMT 2016


Hi

Can we make the GNU-gABI to say, something like:
"STT_FUNC iff function symbol"?

Context is https://goo.gl/cUvLMr

That means, if a language specification (C/C++/Fortran/etc) can detect a 
reference as a function, and hence generates code accordingly, it is a 
must for the tool chain to mark the UNDEF as of type STT_FUNC and not 
STT_NOTYPE. And STT_NOTYPE to be used only when there is no clue from 
any phase of the tool chain to detect the type.

May be something like:
"The type of an undefined symbol shall be the type of its expected 
definition (if known) as per the language specification, otherwise 
STT_NOTYPE is used."

On unix like HP-UX, we have link time symbol type checking for warnings 
and diagnostics. This has indeed helped large sources with ambiguous 
definitions (badly written code).

In my case, an enterprise application engineer had introduced a boolean 
data variable "is_something_true" without knowing that there exists a 
function also in the same name "is_something_true()". At link time, GCC 
went through without warning and failed at runtime. The engineer who has 
his app on all platforms, didnt have to debug as his HP-UX builds had 
linktime warnings.

I thought it makes sense to improve GNU/GCC/Linux also with this.

--
Supra



More information about the Gnu-gabi mailing list