private ExternalLocation addExternal(ExternalLocation externalLocation,
			ProgramMerge programMerge, TaskMonitor monitor) throws DuplicateNameException,
			InvalidInputException, CancelledException, UnsupportedOperationException {

		Address address = externalLocation.getAddress();

		Namespace resolvedNamespace = listingMergeManager.resolveNamespace(
			programMerge.getOriginProgram(), externalLocation.getParentNameSpace());

		Namespace namespace = resolvedNamespace;
		String name = externalLocation.getLabel();
		SourceType sourceType = externalLocation.getSource();

		String originalImportedName = externalLocation.getOriginalImportedName();
		if (originalImportedName != null) {
			namespace = NamespaceUtils.getLibrary(namespace);
			name = originalImportedName;
			sourceType = SourceType.IMPORTED;
		}

		ExternalLocation resultExternalLocation = null;
		// Add External Function

		if (externalLocation.isFunction()) {
			Function function = externalLocation.getFunction();
			if (function == null) {
				throw new AssertException("Uh Oh! Function symbol, but no function.");
			}

			// Add the function by creating a simple function.
			resultExternalLocation = externalManagers[RESULT].addExtFunction(namespace, name,
				address, sourceType, false);
			Function resultFunction = resultExternalLocation.getFunction();
			// Now change the simple function to become the one we actually want.
			programMerge.replaceExternalFunction(resultFunction, function, monitor);
		}
		// Add External Label
		else {
			resultExternalLocation = externalManagers[RESULT].addExtLocation(namespace, name,
				address, sourceType, false);

			// Set the data type to match MY.
			DataType dataType = getResultDataType(externalLocation);
			if (dataType != null && resultExternalLocation != null) {
				resultExternalLocation.setDataType(dataType);
			}
		}
		if (originalImportedName != null) {
			try {
				resultExternalLocation.getSymbol()
						.setNameAndNamespace(externalLocation.getLabel(), resolvedNamespace,
							externalLocation.getSource());
			}
			catch (CircularDependencyException e) {
				throw new AssertException(e);
			}
		}
		return resultExternalLocation;
	}
If there is an external add conflict, but it is between a new external function versus a
new external data label, we don't want to give the user the KeepBoth or MergeBoth options.
@param latestExternalLocation the external location in the Latest program
@param myExternalLocation the external location in the My program
@param monitor a status monitor for feedback and cancelling.
@return true if this is an external function versus external data label.
Ghidra/Features/Base/src/main/java/ghidra/app/merge/listing/ExternalFunctionMerger.java