@Override
	public Symbol createLabel(Address addr, String name, Namespace namespace, SourceType source)
			throws IllegalArgumentException, InvalidInputException {

		if (!addr.isMemoryAddress()) {
			throw new IllegalArgumentException("Invalid memory address: " + addr);
		}

		lock.acquire();
		try {
			namespace = validateNamespace(namespace, addr, SymbolType.LABEL);
			source = validateSource(source, name, addr, SymbolType.LABEL);
			name = validateName(name, source);

			Symbol symbol = getSymbol(name, addr, namespace);
			if (symbol != null) {
				return symbol;
			}

			// If there is a default named function, rename it to the new symbol name
			Symbol functionSymbol = tryUpdatingDefaultFunction(addr, name, namespace, source);
			if (functionSymbol != null) {
				return functionSymbol;
			}

			// if there is a dynamic symbol, delete it and make the new symbol primary.
			Symbol primary = getPrimarySymbol(addr);
			if (primary != null && primary.isDynamic()) {
				deleteDynamicSymbol(primary);
				primary = null;
			}
			boolean makePrimary = (primary == null);

			DBRecord record = doCreateBasicSymbolRecord(name, namespace, addr, SymbolType.LABEL,
				makePrimary, source, false);
			adapter.updateSymbolRecord(record);

			CodeSymbol newSymbol = new CodeSymbol(this, cache, addr, record);

			symbolAdded(newSymbol);
			return newSymbol;
		}
		catch (DuplicateNameException e) {
			throw new RuntimeException("Unexpected", e); // duplicate was avoided above
		}
		catch (IOException e) {
			program.dbError(e);
			return null; // will not occur
		}
		finally {
			lock.release();
		}
	}
Internal method for creating external function symbol.
<p>
NOTE: Any name conflict concerns must be checked before invoking this method. 

@param addr the address for the new symbol
@param name the name of the new symbol
@param namespace the namespace for the new symbol (null may be specified for global
           namespace)
@param source the SourceType of the new symbol
@param externalProgramAddress associated external program memory address (may be null) 
@param originalImportName  original imported name (i.e., mangled name)
@return the new symbol
@throws IOException if IO error occurs
@throws InvalidInputException if the name contains illegal characters (i.e. space)
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/symbol/SymbolManager.java