- Line* L = FirstLine;
- while (L) {
- /* Don't write optimizer hints if not requested to do so */
- if (L->Line[0] == '+') {
- if (Debug) {
- fprintf (F, ";%s\n", L->Line);
- }
- } else {
- fprintf (F, "%s\n", L->Line);
- }
- L = L->Next;
+ SymTable* SymTab;
+ SymEntry* Entry;
+
+ /* Output the global data segment */
+ CHECK (!HaveGlobalCode ());
+ OutputSegments (CS, F);
+
+ /* Output all global or referenced functions */
+ SymTab = GetGlobalSymTab ();
+ Entry = SymTab->SymHead;
+ while (Entry) {
+ if (IsTypeFunc (Entry->Type) &&
+ SymIsDef (Entry) &&
+ (Entry->Flags & (SC_REF | SC_EXTERN)) != 0) {
+ /* Function which is defined and referenced or extern */
+ CS_MergeLabels (Entry->V.F.Seg->Code);
+ RunOpt (Entry->V.F.Seg->Code);
+ OutputSegments (Entry->V.F.Seg, F);
+ }
+ Entry = Entry->NextSym;