/* ca65 */
#include "condasm.h"
#include "error.h"
+#include "global.h"
#include "istack.h"
#include "nexttok.h"
#include "pseudo.h"
IdDesc* I = Mac->M->Locals;
while (I) {
if (strcmp (SVal, I->Id) == 0) {
- /* This is in fact a local symbol, change the name */
- sprintf (SVal, "___%04X__", Mac->LocalStart + Index);
+ /* This is in fact a local symbol, change the name. Be sure
+ * to generate a local label name if the original name was
+ * a local label, and also generate a name that cannot be
+ * generated by a user.
+ */
+ unsigned PrefixLen = (I->Id[0] == LocalStart);
+ sprintf (SVal, "%.*sLOCAL-MACRO-SYMBOL-%04X", PrefixLen,
+ I->Id, Mac->LocalStart + Index);
break;
}
/* Next symbol */