@Override
	protected List<Loaded<Program>> loadProgram(ByteProvider provider, String loadedName,
			Project project, String projectFolderPath, LoadSpec loadSpec, List<Option> options,
			MessageLog log, Object consumer, TaskMonitor monitor)
			throws CancelledException, IOException {

		List<Loaded<Program>> loadedProgramList = new ArrayList<>();
		List<String> libraryNameList = new ArrayList<>();

		boolean success = false;
		try {
			// Load (or get) the primary program
			Program program = null;
			if (!shouldLoadOnlyLibraries(options)) {
				program = doLoad(provider, loadedName, loadSpec, libraryNameList, options, consumer,
					log, monitor);
				loadedProgramList.add(new Loaded<>(program, loadedName, projectFolderPath));
				log.appendMsg("------------------------------------------------\n");
			}
			else if (project != null) {
				ProjectData projectData = project.getProjectData();
				DomainFile domainFile = projectData.getFile(projectFolderPath + "/" + loadedName);
				if (domainFile == null) {
					throw new LoadException(
						"Cannot load only libraries for a non-existant program");
				}
				program = (Program) domainFile.getOpenedDomainObject(consumer);
				if (program == null) {
					throw new LoadException("Failed to acquire a Program");
				}
				loadedProgramList.add(new Loaded<>(program, domainFile));
				libraryNameList.addAll(getLibraryNames(provider, program));
			}

			// Load the libraries
			loadedProgramList.addAll(loadLibraries(provider, program, project, projectFolderPath,
				loadSpec, options, log, consumer, libraryNameList, monitor));

			success = true;
			return loadedProgramList;
		}
		finally {
			if (!success) {
				release(loadedProgramList, consumer);
			}
		}
	}
Loads bytes in a particular format into the given {@link Program}.

@param provider The bytes to load.
@param loadSpec The {@link LoadSpec} to use during load.
@param options The load options.
@param program The {@link Program} to load into.
@param monitor A cancelable task monitor.
@param log The message log.
@throws IOException if there was an IO-related problem loading.
@throws CancelledException if the user cancelled the load.
Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/AbstractLibrarySupportLoader.java