summaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2008-09-22 05:50:34 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2008-09-22 05:50:34 +0000
commitd75c8768e4bd8050bd5b9481e75be4fee296e918 (patch)
tree260a0b0b3732fa1041ab8a426415ec76bd3798bf /gcc/varasm.c
parentf81424362ed2c19415d5c09343737a8c799b47b7 (diff)
downloadgcc-d75c8768e4bd8050bd5b9481e75be4fee296e918.tar.gz
2008-09-22 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r140542 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@140543 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index e74adaed983..4fe3c967032 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -2290,9 +2290,10 @@ process_pending_assemble_externals (void)
to be emitted. */
static GTY(()) tree weak_decls;
-/* Output something to declare an external symbol to the assembler.
- (Most assemblers don't need this, so we normally output nothing.)
- Do nothing if DECL is not external. */
+/* Output something to declare an external symbol to the assembler,
+ and qualifiers such as weakness. (Most assemblers don't need
+ extern declaration, so we normally output nothing.) Do nothing if
+ DECL is not external. */
void
assemble_external (tree decl ATTRIBUTE_UNUSED)
@@ -2303,15 +2304,22 @@ assemble_external (tree decl ATTRIBUTE_UNUSED)
open. If it's not, we should not be calling this function. */
gcc_assert (asm_out_file);
-#ifdef ASM_OUTPUT_EXTERNAL
if (!DECL_P (decl) || !DECL_EXTERNAL (decl) || !TREE_PUBLIC (decl))
return;
- if (SUPPORTS_WEAK && DECL_WEAK (decl))
+ /* We want to output annotation for weak and external symbols at
+ very last to check if they are references or not. */
+
+ if (SUPPORTS_WEAK && DECL_WEAK (decl)
+ /* TREE_STATIC is a weird and abused creature which is not
+ generally the right test for whether an entity has been
+ locally emitted, inlined or otherwise not-really-extern, but
+ for declarations that can be weak, it happens to be
+ match. */
+ && !TREE_STATIC (decl))
weak_decls = tree_cons (NULL, decl, weak_decls);
- /* We want to output external symbols at very last to check if they
- are references or not. */
+#ifdef ASM_OUTPUT_EXTERNAL
pending_assemble_externals = tree_cons (0, decl,
pending_assemble_externals);
#endif
@@ -4064,9 +4072,10 @@ constructor_static_from_elts_p (const_tree ctor)
}
/* A subroutine of initializer_constant_valid_p. VALUE is either a
- MINUS_EXPR or a POINTER_PLUS_EXPR, and ENDTYPE is a narrowing
- conversion to something smaller than a pointer. This returns
- null_pointer_node if the resulting value is an absolute constant
+ MINUS_EXPR or a POINTER_PLUS_EXPR. This looks for cases of VALUE
+ which are valid when ENDTYPE is an integer of any size; in
+ particular, this does not accept a pointer minus a constant. This
+ returns null_pointer_node if the VALUE is an absolute constant
which can be used to initialize a static variable. Otherwise it
returns NULL. */
@@ -4075,6 +4084,9 @@ narrowing_initializer_constant_valid_p (tree value, tree endtype)
{
tree op0, op1;
+ if (!INTEGRAL_TYPE_P (endtype))
+ return NULL_TREE;
+
op0 = TREE_OPERAND (value, 0);
op1 = TREE_OPERAND (value, 1);