static boolean equivalentSymbols(Program p1, Program p2, Symbol p1Symbol, Symbol p2Symbol) {
		if (p1Symbol == p2Symbol) {
			return true;
		}
		if (p1Symbol == null) {
			return (p2Symbol == null);
		}
		if (p2Symbol == null) {
			return false;
		}
		SourceType p1SourceType = (p1Symbol instanceof GlobalSymbol) ? null : p1Symbol.getSource();
		SourceType p2SourceType = (p2Symbol instanceof GlobalSymbol) ? null : p2Symbol.getSource();
		if (p1SourceType != p2SourceType) {
			return false;
		}
		if ((p1SourceType != SourceType.DEFAULT) &&
			!p1Symbol.getName().equals(p2Symbol.getName())) {
			return false;
		}
		if (p1Symbol.isDynamic()) {
			return p2Symbol.isDynamic();
		}
		else if (p2Symbol.isDynamic()) {
			return false;
		}
		Address p1SymbolAddress = p1Symbol.getAddress();
		Address p2SymbolAddress = p2Symbol.getAddress();
		Address p2SymbolAddressAsP1 =
			SimpleDiffUtility.getCompatibleAddress(p2, p2SymbolAddress, p1);
		if (!p1SymbolAddress.equals(p2SymbolAddressAsP1)) {
			return false;
		}
		if (!p1Symbol.getSymbolType().equals(p2Symbol.getSymbolType())) {
			return false;
		}
		if (p1Symbol.isPrimary() != p2Symbol.isPrimary()) {
			return false;
		}
		if (p1Symbol.isPinned() != p2Symbol.isPinned()) {
			return false;
		}

		Symbol p1Parent = p1Symbol.getParentSymbol();
		Symbol p2Parent = p2Symbol.getParentSymbol();
		if (!equivalentSymbols(p1, p2, p1Parent, p2Parent)) {
			return false;
		}
		return true;
	}
Provides comparisons between two defined data code units.
Ghidra/Features/Base/src/main/java/ghidra/program/util/ProgramDiff.java