<< Back to previous view

[PCC-356] tls data section has wrong flags? Created: 12/Jun/11  Updated: 30/Jun/11

Status: Closed
Project: pcc
Component/s: i386 target
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Iain Hibbert Assignee: Unassigned
Resolution: Fixed Votes: 0
Environment: NetBSD/i386

File Attachments: File tdata.diff    

Hi, the following code

  __thread int foo = 1;
  __thread int bar;

when compiled with "pcc -c" produces warnings

  foo.s: Assembler messages:
  foo.s:8: Warning: ignoring changed section attributes for .tdata

this is on NetBSD at least, using

  GNU assembler version 2.19.1 (i486--netbsdelf) using BFD version (NetBSD Binutils nb1) 2.19.

I fixed it (as per attached tdata.diff) by adding "T" to the section flags similarly to what has
been done with amd64..

Comment by Iain Hibbert [ 25/Jun/11 08:16 PM ]
This was fixed with recent commits, except that a new issue was introduced.. compiling a
uninitialised __thread variable with -fPIC causes a NULL pointer dereference when printing
a string, making (at least here) the section directive to be "(null)"

% cat t.c
__thread int t;
% pcc -fPIC -S t.c
% cat t.s
        .align 4
        .size t,4
        .space 4
        .ident "PCC: pcc 1.1.0.DEVEL 20110625 for netbsd-i386"
Comment by Anders Magnusson [ 30/Jun/11 09:45 PM ]
Requestor reports this bug is fixed.
Generated at Tue Jun 19 08:39:46 CEST 2018 using JIRA Enterprise Edition, Version: 3.13.1-#333.