These are the steps to link the customized startup code in XC32:
Copy the default startup code "crt0.S”, available under the folder “<Compiler-DIR>\pic32-libs\libpic32\startup”, to your project directory.
Customize this Startup code, by making the changes as required.
Add this modified startup code (crt0.S) to the MPLAB® X IDE Project under “Source Files”.
You may also change the name of your custom startup code to something like 'my_startup.S'.
Set the options to exclude linking of default Startup code.
Under MPLAB X IDE go to:
File ▶ Project Properties ▶ xc32-ld ▶ Option categories = Libraries ▶ Check the option 'Do not link startup code' ▶ Click 'Ok'
The code will now link with the customized startup code.
Note that the default startup code source, crt0.S, uses many device-specific macros that should be defined as appropriate for your target device.