Today, the implementation in the compiler includes effectively jamming all of the extern blocks into one C file. I think it's a reasonable point that this causes the problem you describe above. I'd recommend you make an issue about that since it's not trivial to address but your use case here is worth recording that way. (Or I could make an issue just pasting your example above. It does not need a lot more detail).
Anyway, I don't know of a quick workaround other than renaming your truncate function.