// perform next pass over the i-th file in the list private void processFile(int i) { string currFileName = fileList[i]; if (currFileName == null) { Debug.WriteLine("error? -- missing file name"); return; } if (!File.Exists(currFileName)) { throw new AsmException("Cannot access file " + currFileName); } ArmFileInfo fileInfo = FileInfoTable[i]; switch (getSuffix(currFileName)) { case ".s": // process ARM assembly language file by invoking the CodeSourcery version // of Gnu's as program, translating it into a .o file -- then the .o file // is handled in the same way as any .o file bool asmOK = true; if (pass == 1) { string objFileName = mapSrcToTempObj(currFileName); asmOK = runAssembler(currFileName, objFileName); if (asmOK) { fileInfo = new ObjFromAsmFileInfo(objFileName, currFileName, listing, symTabListing, globalSymbols, externSymbols); } else { fileInfo = new AsmFileInfo(currFileName, globalSymbols, externSymbols); } FileInfoTable[i] = fileInfo; listing.Clear(); symTabListing.Clear(); } else { fileInfo.ProgramSpace = ap; } if (fileInfo.Pass < pass && asmOK) { fileInfo.Pass = pass; fileInfo.StartPass(); } break; case ".o": // object code file case ".o)": // member of a library archive // process ELF format object code file if (fileInfo == null) { fileInfo = new ObjFileInfo(currFileName, globalSymbols, externSymbols); FileInfoTable[i] = fileInfo; } if (pass == 2) { fileInfo.ProgramSpace = ap; } if (fileInfo.Pass < pass) { fileInfo.Pass = pass; fileInfo.StartPass(); } break; case ".a": // accept a Gnu format archive file containing ELF object code members if (fileInfo == null) { searchLibrary(currFileName); } else { throw new AsmException( "unexpected library file in pass 2: {0}", currFileName); } break; default: throw new AsmException("unsupported file type ({0})", currFileName); } }
// perform next pass over the i-th file in the list private void processFile(int i) { string currFileName = fileList[i]; if (currFileName == null) { Debug.WriteLine("error? -- missing file name"); return; } // Bill M. was here. We do NOT want to check for the existence of the files here. // As libraries are scanned the file list increases, and the names of the fuctions // from the library is added to the filename. Thus, bring in "printf" or something // and you get "libc.a(printf.o)" which does not exist. // if (!File.Exists(currFileName)) // throw new AsmException("Cannot access the file named \"" + currFileName + "\""); ArmFileInfo fileInfo = FileInfoTable[i]; switch (getSuffix(currFileName)) { case ".s": // process ARM assembly language file by invoking the CodeSourcery version // of Gnu's as program, translating it into a .o file -- then the .o file // is handled in the same way as any .o file bool asmOK = true; if (pass == 1) { string objFileName = mapSrcToTempObj(currFileName); asmOK = runAssembler(currFileName, objFileName); if (asmOK) { fileInfo = new ObjFromAsmFileInfo(objFileName, currFileName, listing, symTabListing, globalSymbols, externSymbols); } else { fileInfo = new AsmFileInfo(currFileName, globalSymbols, externSymbols); } FileInfoTable[i] = fileInfo; listing.Clear(); symTabListing.Clear(); } else { fileInfo.ProgramSpace = ap; } if (fileInfo.Pass < pass && asmOK) { fileInfo.Pass = pass; fileInfo.StartPass(); } break; case ".o": // object code file case ".o)": // member of a library archive // process ELF format object code file if (fileInfo == null) { fileInfo = new ObjFileInfo(currFileName, globalSymbols, externSymbols); FileInfoTable[i] = fileInfo; } if (pass == 2) { fileInfo.ProgramSpace = ap; } if (fileInfo.Pass < pass) { fileInfo.Pass = pass; fileInfo.StartPass(); } break; case ".a": // accept a Gnu format archive file containing ELF object code members if (fileInfo == null) { searchLibrary(currFileName); } else { throw new AsmException( "unexpected library file in pass 2: {0}", currFileName); } break; default: throw new AsmException("unsupported file type ({0})", currFileName); } }