Coverage instrumentation on a large project


I am trying to link a very large (3.5 gigabytes) library. This works fine normally. However, when trying to pass -fprofile-instr-generate & -fcoverage-mapping, the compilation now fails during the linking step, complaining about a “relocation overflow: reference to local symbol in ” for many, many symbols.

Is there a commandline switch I can pass to prevent this without having to redo the large legacy source code? I have already attempted using a newer clang version (currently using 6.0) and/or passing -mcmodel=large and -mcmodel=medium, but to no avail.

Just helping me try to understand what precisely this means would also be helpful.

Thank you