簡體   English   中英

為什么__thread在使用printf語句時會出現鏈接器錯誤?

[英]why __thread gives linker error when printf statement is used?

這是我的示例程序,

int main()
{
   static __thread int a;

   printf("\n %d",a);

   return 0;
}

在這個程序中,刪除printf語句時,鏈接正常。 當包含printf語句時,它會給出以下鏈接器錯誤

ld: fatal: relocation error: R_SPARC_TLS_LE_HIX22: file /var/tmp//ccwb2Cxc.o: symbol <unknown>: bad symbol type SECT: symbol type must be TLS

處理器:SUN-SPARC OS:UNIX

據我所知,這是自2006年以來Sun鏈接器的一個已知問題。如果將整數復制到本地(非線程),它是否適用於您?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM