Our promise is that as long as there's no fatal error (i.e. broken
file is given to the linker), our main function returns to the caller.
So we can't use exit() in the regular code path.
Details
Details
Diff Detail
Diff Detail
- Repository
- rLLD LLVM Linker
Event Timeline
Comment Actions
If we use return (instead of exit) as in this patch, the final params file( Config->ThinLTOIndexOnlyObjectsFile) is not fully generated and few of the last entries are not written(even though respective files are generated) . Here _exit() is called eventually from exitLld function call in elf::link . However, if we replace that with exit(), the file is generated properly. From here, it seems that _exit() is not able to close the file properly.
Comment Actions
_exit() doesn't flush the buffer indeed. So it is likely that the LTO object holds file handles until it is destroyed. Maybe we should call the destructor before returning. Let me try that.
Do you know how I can test it?