]> git.pld-linux.org Git - packages/gcc.git/blob - gcc32-attr-visibility2.patch
- merged lost change:
[packages/gcc.git] / gcc32-attr-visibility2.patch
1 2002-03-06  Jakub Jelinek  <jakub@redhat.com>
2
3         * config/i386/i386.h (REDO_SECTION_INFO_P): Define.
4
5 2002-03-02  Richard Henderson  <rth@redhat.com>
6
7         * config/i386/i386.h (ENCODE_SECTION_INFO): MODULE_LOCAL_P applies
8         to functions as well.
9
10 2002-03-02  Richard Henderson  <rth@redhat.com>
11
12         * attribs.c (handle_visibility_attribute): Don't call
13         assemble_visibility.
14         * varasm.c (maybe_assemble_visibility): New.
15         (assemble_start_function, assemble_variable, assemble_alias): Use it.
16
17 --- gcc/config/i386/i386.h.jj   Tue Jun  4 18:54:32 2002
18 +++ gcc/config/i386/i386.h      Tue Jun  4 18:54:42 2002
19 @@ -2268,12 +2268,13 @@ do {                                                            \
20             SYMBOL_REF_FLAG (XEXP (rtl, 0))                     \
21               = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd'      \
22                  || ! TREE_PUBLIC (DECL)                        \
23 -                || (TREE_CODE (DECL) == VAR_DECL               \
24 -                    && MODULE_LOCAL_P (DECL)));                \
25 +                || MODULE_LOCAL_P (DECL));                     \
26           }                                                     \
27        }                                                                \
28  } while (0)
29  
30 +#define REDO_SECTION_INFO_P(DECL) 1
31 +
32  /* The `FINALIZE_PIC' macro serves as a hook to emit these special
33     codes once the function is being compiled into assembly code, but
34     not before.  (It is not done before, because in the case of
35 --- gcc/varasm.c.jj     Tue Jun  4 18:54:32 2002
36 +++ gcc/varasm.c        Tue Jun  4 18:54:42 2002
37 @@ -167,6 +167,7 @@ static unsigned min_align           PARAMS ((unsi
38  static void output_constructor         PARAMS ((tree, HOST_WIDE_INT,
39                                                  unsigned int));
40  static void globalize_decl             PARAMS ((tree));
41 +static void maybe_assemble_visibility  PARAMS ((tree));
42  static int in_named_entry_eq           PARAMS ((const PTR, const PTR));
43  static hashval_t in_named_entry_hash   PARAMS ((const PTR));
44  #ifdef ASM_OUTPUT_BSS
45 @@ -1238,6 +1239,8 @@ assemble_start_function (decl, fnname)
46         }
47  
48        globalize_decl (decl);
49 +
50 +      maybe_assemble_visibility (decl);
51      }
52  
53    /* Do any machine/system dependent processing of the function name */
54 @@ -1591,6 +1594,9 @@ assemble_variable (decl, top_level, at_e
55    DECL_ALIGN (decl) = align;
56    set_mem_align (decl_rtl, align);
57  
58 +  if (TREE_PUBLIC (decl))
59 +    maybe_assemble_visibility (decl);
60 +
61    /* Handle uninitialized definitions.  */
62  
63    if ((DECL_INITIAL (decl) == 0 || DECL_INITIAL (decl) == error_mark_node)
64 @@ -5167,7 +5173,11 @@ assemble_alias (decl, target)
65  #ifdef ASM_OUTPUT_DEF
66    /* Make name accessible from other files, if appropriate.  */
67    if (TREE_PUBLIC (decl))
68 -    globalize_decl (decl);
69 +    {
70 +      globalize_decl (decl);
71 +
72 +      maybe_assemble_visibility (decl);
73 +    }
74  
75  #ifdef ASM_OUTPUT_DEF_FROM_DECLS
76    ASM_OUTPUT_DEF_FROM_DECLS (asm_out_file, decl, target);
77 @@ -5213,6 +5223,21 @@ assemble_visibility (decl, visibility_ty
78  #endif
79  }
80  
81 +/* A helper function to call assemble_visibility when needed for a decl.  */
82 +
83 +static void
84 +maybe_assemble_visibility (decl)
85 +     tree decl;
86 +{
87 +  tree visibility = lookup_attribute ("visibility", DECL_ATTRIBUTES (decl));
88 +  if (visibility)
89 +    {
90 +      const char *type
91 +       = TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (visibility)));
92 +      assemble_visibility (decl, type);
93 +    }
94 +}
95 +
96  /* Returns 1 if the target configuration supports defining public symbols
97     so that one of them will be chosen at link time instead of generating a
98     multiply-defined symbol error, whether through the use of weak symbols or
99 --- gcc/attribs.c.jj    Tue Jun  4 18:54:32 2002
100 +++ gcc/attribs.c       Tue Jun  4 18:54:42 2002
101 @@ -1101,8 +1101,6 @@ handle_visibility_attribute (node, name,
102           *no_add_attrs = true;
103           return NULL_TREE;
104         }
105 -
106 -      assemble_visibility (decl, TREE_STRING_POINTER (id));
107      }
108  
109    return NULL_TREE;
This page took 2.034109 seconds and 3 git commands to generate.