I think one has main for a self-programming thing, and one had the normal mail.I have no idea what the difference is, or what they do.
The .ld file is a linker script. You might figure out something from comparing it to the non-self linker script. It defines some extra memory sections:
Regular:
- rom (rx) : ORIGIN = 0x00000000, LENGTH = 16K
- ram (rwx) : ORIGIN = 0x20000000, LENGTH = 192K
_Self version:
+ rom (rx) : ORIGIN = 0x00004000, LENGTH = 0x00080000 - 0x4000
+ ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00030000
+ bkupram (rwx) : ORIGIN = 0x47000000, LENGTH = 0x00002000
+ qspi (rwx) : ORIGIN = 0x04000000, LENGTH = 0x01000000
main.c says it contains the SAM-BA code (which is the Atmel Bootloader.) selfmain.c is entirely different? Note the different start addresses for ROM.
As a guess, the chip winds up with two bootloaders - the normal SAM-BA bootloader that starts first, and later in rom the UF2 (disk emulating) bootloader - that's consistent with the way the Adafruit SAMD51 boards behave.