By taking a patched binary and unpatched binary and running them through a diffing tool.
There is bindiff, or you can use the Diaphora plugin for IDA Pro, or you can use Ghidra diff correlators.
There is bindiff, or you can use the Diaphora plugin for IDA Pro, or you can use Ghidra diff correlators.