Author Topic: With thread local storage, Need solution  (Read 7059 times)

Offline Sharlenehargrove

  • Jr. Member
  • *
  • Posts: 7
With thread local storage, Need solution
« on: February 01, 2023, 09:20:01 AM »
Following is a simple shared object with thread local storage.  The syntax in the section TLS_Test_fn is taken from section "7.9.4 Thread Local Storage in ELF: elf Special Symbols and WRT" in the NASM 2.13.02 manual (corresponding to the version installed on my Ubuntu 18.04).

The two lines that that uses the TLS variable are:

   mov rax,[rel MQ_FDes_Core wrt ..gottpoff]
   mov rcx,[fs:rax]

I assemble with NASM assembler:

   sudo nasm -f elf64 -g -F dwarf TLS_Test.asm

and I get:

   "TLS_Test.asm:24: error: unable to find a suitable global symbol for this reference"

If I write it as mov rax,[MQ_FDes_Core wrt ..gottpoff] I get the same error.  DQFanSurvey.com
« Last Edit: February 02, 2023, 04:48:01 AM by Sharlenehargrove »

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: With thread local storage, Need solution
« Reply #1 on: February 02, 2023, 01:44:47 AM »
Dunno.

Your code looks just like the manual.

Also see the next section on extensions to "global"... and that they are necessary! Could that be your problem?

Best,
Frank