private Symbol getCodeOrFunctionSymbol(CodeUnit cu, int symbolIndex) {
		Symbol[] symbols = cu.getSymbols();
		if (symbols.length == 0) {
			return null;
		}

		makePrimaryLastItem(symbols);

		if (symbolIndex >= symbols.length) {
			symbolIndex = symbols.length - 1;
		}
		Symbol symbol = symbols[symbolIndex];
		SymbolType symbolType = symbol.getSymbolType();
		if (symbolType != SymbolType.LABEL && symbolType != SymbolType.FUNCTION) {
			return null;
		}
		return symbol;
	}
Move primary symbol to last element in array ...
Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/LabelFieldFactory.java