DF_STATIC_TLS flag indicates that the shared object or executable contains code using a static thread-local storage scheme.
Patch checks if IE/LE relocations were used to check if the code uses a static model. If so it sets the DF_STATIC_TLS flag.
It is based on D32354 which was reverted because we decided to not support the DF_STATIC_TLS at that time.
But now it will be used in FreeBSD.
I don't remember if this function is called from a multi-threaded part of lld. If that's the case, mutating a variable is not considered thread-safe, even if you are just mutating a boolean variable and set it to the same value from everywhere.