Made local code/data labels really local to the functions where they live in.

This commit is contained in:
acqn
2020-08-23 01:35:18 +08:00
committed by Oliver Schmidt
parent 86ced2bd4c
commit d02b12fa6c
7 changed files with 78 additions and 18 deletions

View File

@@ -389,6 +389,12 @@ void Compile (const char* FileName)
/* Create the global code and data segments */
CreateGlobalSegments ();
/* There shouldn't be needs for local labels outside a function, but the
** current code generator still tries to get some at times even though the
** code were ill-formed. So just set it up with the global segment list.
*/
UseLabelPoolFromSegments (GS);
/* Initialize the literal pool */
InitLiteralPool ();
@@ -488,6 +494,9 @@ void FinishCompile (void)
*/
for (Entry = GetGlobalSymTab ()->SymHead; Entry; Entry = Entry->NextSym) {
if (SymIsOutputFunc (Entry)) {
/* Continue with previous label numbers */
UseLabelPoolFromSegments (Entry->V.F.Seg);
/* Function which is defined and referenced or extern */
MoveLiteralPool (Entry->V.F.LitPool);
CS_MergeLabels (Entry->V.F.Seg->Code);