How can I save the final relocatiable file before linking when using lto(-flto)

I am working on a bug that lld emits an error about the invalid relocation range of a branch instruction. I wonder if there is a way to cache the final combined relocatable file when using lto?

I tried stuff such as -Wl,–thinlto-cache-dir=cache and -Wl,-r, but they do not work :smiling_face_with_tear:

lld has a --save-temps option that might do what you want.

2 Likes

it is exactly what I am looking for. Thanks a lot!