So I have been working on a custom engine, to move a mod I originally made on Half-Life 1 onto it. In the mod I had already rewritten the renderer and disabled the original rendering pipeline, and this new renderer uses GLSL shaders and VBOs and FBOs. The mod in total uses about 1240 shaders if on-demand shader loading is disabled. In the mod, these shaders take about ten seconds to compile, all of them at once that is.
When I made my custom engine, I moved my renderer from the mod version into the engine, with only minor modifications to the basic classes. This also includes the class that manages GLSL shaders. However in the custom engine, the shaders take an agonizingly long time to compile. I can showcase the statistics below:
Half-Life 1:

Custom engine:

Please disregard the GL version, as I forgot to remove the constraint from the copy I did these stats on. Changing the version also had no effect. Also I ran both of these with the shader cache nuked, so both applications had to create the cache from scratch.
The custom engine itself runs under SDL2, and is 64-bit. So far I haven't been able to find why glLinkPrograms is so slow, when compared to the mod version. I tried nuking the nVidia shader cache completely, and letting both applications run. The Half-Life 1 mod version compiles lightning fast, while the custom engine is agonizingly slow. However once the custom engine compiles all the shaders and caches them, it becomes marginally faster on second initialization.
Edit: Link to the pastebin example of a shader that takes over a second to load/link:
https://pastebin.com/u58zjNKi
Any help is greatly apprechiated.