public LinkedLibrary add(LibraryFile library) { LinkedLibrary result = new LinkedLibrary(); result.linker = this; result.file = library; result.symbols = new LinkedSymbol[library.nsymbols]; for (uint i = 0; i < library.nsymbols; i++) { result.symbols[i] = new LinkedSymbol(); result.symbols[i].library = result; result.symbols[i].index = i; } libraries.Add(result); for (uint i = 0; i < library.nsections; i++) { if (sections.ContainsKey(library.sectionName(i))) { LinkedSection s = null; sections.TryGetValue(library.sectionName(i), out s); // WTF? Why doesn't "Get"/"GetValue" work? result.add(s.add(result, i)); } } return(result); }
public LinkedSection setup(string name, ulong offset, bool readable, bool writable, bool executable, uint alignment = 16) { if (sections.ContainsKey(name)) { throw new LinkerException(this, "Section '" + name + "' is already setup"); } LinkedSection s = new LinkedSection(); s.linker = this; s.name = name; s.offset = offset; s.size = 0; s.readable = readable; s.writable = writable; s.executable = executable; s.alignment = alignment; sections.Add(name, s); return(s); }