How to use an archive library without getting stuck in default handler

I created a platformio project for ststm32 platform without a framework
then I added my library in lib/ directory with the necessary flas in the library.json file

the library itself is a big codebase that has freertos and stm32 HAL + ISRs definitions

Currently the user code and the library can be built successfully and runs correctly on the mcu

However the program works fine only when I set “libArchive” to false in library.json.

If I set it to true then the programs enter in a default handler and gets stuck there.

I need to use the lib archive option because later I’m going to use only the archive with the header files.

My question is: Is there a way to link/use the ISRs inside the library and avoid getting the default handle?

In this thread it is mentioned that:

Caveat note: libArchive: false is very important. FreeRTOS will hook interrupt functions like the SysTick or the system supervisor calls (SVC). Packing FreeRTOS as an .a archive file and linking it as such must not be done because in the final firmware link, would the interrupt functions would not correctly link to FreeRTOS but the default / empty ones in the Arduino core.

Which I want to avoid because I need to generate a .a archive and let it use the ISRs definitions inside it and not the default ones.

The issue seems to be related to the fact that the linker links the default weak ISRs instead of overriding them with the ones defined in the library.

This is somehow strange because I’m not even using a framework.

It seems that the linker encounters the weak definitions first the ignores the other definitions.