Commits

Iain Buclaw committed 6f10e57

Move code that sets visibility of thunks out of outputThunk.

Comments (0)

Files changed (2)

         DECL_ARTIFICIAL(thunk_decl) = 1;
         DECL_DECLARED_INLINE_P(thunk_decl) = 0;
 
+        DECL_VISIBILITY(thunk_decl) = DECL_VISIBILITY(target_func_decl);
+        DECL_VISIBILITY_SPECIFIED(thunk_decl)
+            = DECL_VISIBILITY_SPECIFIED(target_func_decl);
+        //needed on some targets to avoid "causes a section type conflict"
+        D_DECL_ONE_ONLY(thunk_decl) = D_DECL_ONE_ONLY(target_func_decl);
+        if (D_DECL_ONE_ONLY(thunk_decl))
+            g.ofile->makeDeclOneOnly(thunk_decl);
+
         DECL_NAME(thunk_decl) = get_identifier(id);
         SET_DECL_ASSEMBLER_NAME (thunk_decl, DECL_NAME(thunk_decl));
 
     TREE_ADDRESSABLE(target_decl) = 1;
     TREE_USED(target_decl) = 1;
 
-    TREE_ADDRESSABLE(thunk_decl) = 1;
-    TREE_USED(thunk_decl) = 1;
-    DECL_EXTERNAL(thunk_decl) = 0;
-
-    TREE_PUBLIC(thunk_decl) = TREE_PUBLIC(target_decl);
-    DECL_VISIBILITY(thunk_decl) = DECL_VISIBILITY(target_decl);
-    DECL_VISIBILITY_SPECIFIED(thunk_decl)
-        = DECL_VISIBILITY_SPECIFIED(target_decl);
-    //needed on some targets to avoid "causes a section type conflict"
-    D_DECL_ONE_ONLY(thunk_decl) = D_DECL_ONE_ONLY(target_decl);
-    if (D_DECL_ONE_ONLY(thunk_decl))
-        g.ofile->makeDeclOneOnly(thunk_decl);
-
     if (flag_syntax_only)
     {
         TREE_ASM_WRITTEN(thunk_decl);