avoid keeping symbols in static local variables

They will become invalid if the symbol table is cleared.
entities in record_entity must have a name
rename local variable to simplify code

inside record_entity() it should be clear that previous_entity is about
an entity so we call it just "previous" now.
cleanup: move is_main around
move missing prototype checks into own function
Support attribute((alias()))

Also rework multiple definition reporting in the process to correctly
catch the error cases where aliases are mixed with definitions.