private void adjustSegmentStarts(Program program, TaskMonitor monitor) throws Exception {
		monitor.setMessage("Adjusting segments...");

		if (!program.hasExclusiveAccess()) {
			return;
		}

		Memory memory = program.getMemory();
		MemoryBlock[] blocks = memory.getBlocks();

		for (int i = 1; i < blocks.length; i++) {
			monitor.checkCancelled();
			MemoryBlock block = blocks[i];
			if (!block.isInitialized()) {
				continue;
			}
			//scan the first 0x10 bytes of this block
			//if a FAR RETURN exists, then move that code
			//to the preceding block...
			int mIndex = 15;
			if (block.getSize() <= 16) {
				mIndex = (int) block.getSize() - 2;
			}
			for (; mIndex >= 0; mIndex--) {
				monitor.checkCancelled();
				Address offAddr = block.getStart().add(mIndex);
				int val = block.getByte(offAddr);
				val &= 0xff;
				if (val == FAR_RETURN_OPCODE) {
					// split here and join to previous
					Address splitAddr = offAddr.add(1);
					String oldName = block.getName();
					String oldSourceName = block.getSourceName();
					memory.split(block, splitAddr);
					memory.join(blocks[i - 1], blocks[i]);
					blocks = memory.getBlocks();
					blocks[i].setName(oldName);
					blocks[i].setSourceName(oldSourceName);
					break;
				}
			}
		}

		// Recreate the Program Tree since it may now be out of sync
		program.getListing().removeTree(TreeManager.DEFAULT_TREE_NAME);
		program.getListing().createRootModule(TreeManager.DEFAULT_TREE_NAME);
	}
Stores a relocation's fixup information

@param relocation The original relocation info
@param address The {@link SegmentedAddress} of the relocation
@param fileOffset The file offset of the relocation
@param segment The fixed-up segment after the relocation is applied
@param valid True if the relocation is valid; otherwise, false
Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MzLoader.java