protected List<String> processLibraries() throws Exception {
		Options props = program.getOptions(Program.PROGRAM_INFO);
		int libraryIndex = 0;
		List<String> libraryPaths = new ArrayList<>();
		List<LoadCommand> loadCommands = machoHeader.getLoadCommands();
		monitor.initialize(loadCommands.size(), "Processing libraries...");
		for (LoadCommand command : loadCommands) {
			monitor.increment();

			String libraryPath = null;

			if (command instanceof DynamicLibraryCommand dylibCommand &&
				dylibCommand.getCommandType() != LoadCommandTypes.LC_ID_DYLIB) {
				DynamicLibrary dylib = dylibCommand.getDynamicLibrary();
				libraryPath = dylib.getName().getString();
			}
			else if (command instanceof SubLibraryCommand sublibCommand) {
				libraryPath = sublibCommand.getSubLibraryName().getString();
			}
			else if (command instanceof PreboundDynamicLibraryCommand pbdlCommand) {
				libraryPath = pbdlCommand.getLibraryName();
			}

			if (libraryPath != null) {
				int index = libraryPath.lastIndexOf("/");
				String libraryName = index != -1 ? libraryPath.substring(index + 1) : libraryPath;
				if (!libraryName.equals(program.getName())) {
					libraryPaths.add(libraryPath);
					addLibrary(libraryPath);
					props.setString(
						ExternalSymbolResolver.getRequiredLibraryProperty(libraryIndex++),
						libraryPath);
				}
			}
		}

		if (program.getSymbolTable().getLibrarySymbol(Library.UNKNOWN) == null) {
			program.getSymbolTable().createExternalLibrary(Library.UNKNOWN, SourceType.IMPORTED);
		}

		return libraryPaths;
	}
Processes the local relocations from all {@link DynamicSymbolTableCommand}s.

@throws CancelledException if the operation was cancelled.
Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoProgramBuilder.java