This is PR32437.
DF_STATIC_TLS
If set in a shared object or executable, this flag instructs the dynamic linker to reject attempts to load this file dynamically. It indicates that the shared object or executable contains code using a static thread-local storage scheme. Implementations need not support any form of thread-local storage.
Patch checks if IE/LE relocations were used to check if code uses static model. If so it sets the DF_STATIC_TLS flag.
Patch contains testcases for i386 target for now.
I don't want to bury this code deep inside the relocation processing like this. Can you create a different for loop that visits each input section's Relocations vector elements to see if there's a TLS relocation?