mark globals as internal when not building a library

Closes #9494
auto merge of #9548 : thestinger/rust/internal, r=alexcrichton

Closes #9494