https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92160

            Bug ID: 92160
           Summary: The control variable of TLS variable alias be removed
                    when use emutls(--enable-tls=no)
           Product: gcc
           Version: 9.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: unclepom at sina dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

------- tls.c ---------
TLS int oldname = 7;
extern TLS int newname __attribute__((alias("oldname")));
-----------------------

The control variable "__emutls_v.newname" will be removed, because
tree-emutls.c:new_emutls_decl not copy "externally_visible" flag.

The patch below may fix this bug.

--- a/tree-emutls.c     2019-01-01 20:31:55.000000000 +0800
+++ b/tree-emutls.c     2019-10-19 22:54:40.478401699 +0800
@@ -345,6 +345,7 @@

       n = varpool_node::create_alias (to, t->decl);
       n->resolve_alias (t);
+      n->externally_visible = t->externally_visible;
     }
   return to;
 }

../gcc-9.2.0/configure -v --enable-languages=c,c++
--prefix=/home/pom/Documents/Work/LiBox/gcc-out --with-gcc-major-version-only
--program-suffix=-8 --program-prefix=x86_64-linux-gnu- --enable-shared
--enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --libdir=/usr/lib --enable-bootstrap
--enable-clocale=gnu --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-default-pie --with-system-zlib
--with-target-system-zlib --disable-werror -with-abi=m64 --disable-multilib
--with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu --enable-tls=no

Reply via email to