Skip to content
  • H.J. Lu's avatar
    gold: Support 386 TLS code sequences without PLT · b287eca3
    H.J. Lu authored
    There are extensions to 386 psABI:
    
    https://groups.google.com/forum/#!topic/ia32-abi/awsRSvJOJfs
    
    to call tls_get_addr via GOT:
    
    call *___tls_get_addr@GOT(%reg)
    
    where EBX register isn't required as GOT base.
    
    Since direct call is 4-byte long and indirect call, is 5-byte long, the
    extra one byte must be handled properly.
    
    For general dynamic model, 7-byte lea instruction before call
    instruction is replaced by 6-byte one to make room for indirect call.
    For local dynamic model, we simply use 5-byte indirect call.
    
    TLS linker optimization is updated to recognize new instruction
    patterns.  For local dynamic model to local exec model transition,
    we generate a 6-byte lea instruction as nop, instead of a 1-byte nop
    plus a 4-byte lea instruction.
    
    	PR gold/20308
    	* i386.cc (Target_i386::Relocate::relocate): Allow
    	R_386_GOT32X relocation against ___tls_get_addr.
    	(Target_i386::Relocate::tls_gd_to_ie): Support indirect
    	call to __tls_get_addr.
    	(Target_i386::Relocat...
    b287eca3