he following patch fixes PR 21801 and PR 21275 by moving the setting of
DECL_NON_ADDR_CONST_P for DECLS of dllimport'd symbols forward to when
the attribute is first handled, rather than postponing until we
encode_section_info.
There may be a problem with this on sh-symbian. That target does not
currently set DECL_NON_ADDR_CONST_P for dllimports, even though some of
the comments in config/sh/symbian.c suggest that it should (are those
comments just leftovers from winnt.c?) Could a sh-symbian maintainer
help with this? Nick, I'm cc'ing you since you contributed symbian.c. Do
I need to guard DECL_NON_ADDR_CONST_P in handle_dll_attribute with a
TARGET_IS_PE_COFF macro?
Bootstrapped and regtested with C, C++, Ada on i686-pc-mingw32.
Danny
2005-05-01 Danny Smith <dannysmith@users.sourceforge.net>
* tree.c (handle_dll_attribute): Set DECL_NON_ADDR_CONST_P for dllimports
here...
* config/i386/winnt.c (i386_pe_mark_dllimport): ...not here.
Index: tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.c,v
retrieving revision 1.475
diff -c -3 -p -r1.475 tree.c
*** tree.c 23 Apr 2005 21:28:00 -0000 1.475
--- tree.c 30 Apr 2005 23:44:03 -0000
*************** handle_dll_attribute (tree * pnode, tree
*** 3314,3320 ****
if (current_function_decl != NULL_TREE && !TREE_STATIC (node))
TREE_PUBLIC (node) = 1;
}
! }
/* Report error if symbol is not accessible at global scope. */
if (!TREE_PUBLIC (node)
--- 3314,3324 ----
if (current_function_decl != NULL_TREE && !TREE_STATIC (node))
TREE_PUBLIC (node) = 1;
}
!
! /* The symbol is resolved via an indirect reference so we can't treat
! a pointer to this as a constant address. */
! DECL_NON_ADDR_CONST_P (node) = 1;
! }
/* Report error if symbol is not accessible at global scope. */
if (!TREE_PUBLIC (node)
Index: config/i386/winnt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/winnt.c,v
retrieving revision 1.80
diff -c -3 -p -r1.80 winnt.c
*** config/i386/winnt.c 23 Apr 2005 21:28:21 -0000 1.80
--- config/i386/winnt.c 30 Apr 2005 23:44:05 -0000
*************** i386_pe_mark_dllimport (tree decl)
*** 345,352 ****
newrtl = gen_rtx_MEM (Pmode,symref);
XEXP (DECL_RTL (decl), 0) = newrtl;
- /* Can't treat a pointer to this as a constant address */
- DECL_NON_ADDR_CONST_P (decl) = 1;
}
/* Return string which is the former assembler name modified with a
Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com