[Patch] Fix PR 21275, PR21597 cygwin/mingw32 bootstrap regressions on trunk - Ping
Danny Smith
dannysmith@clear.net.nz
Tue Oct 11 01:15:00 GMT 2005
Hello
This dllimport bug still prevents bootstrap on cygwin and mingw.
I have attached patch previously submitted at
http://gcc.gnu.org/ml/gcc-patches/2005-08/msg01543.html
That post addressed questions raised by Mark on the original patch.
Tested on i686-pc-mingw32,
../gcc/configure --with-gcc --host=mingw32 --build=mingw32
--target=mingw32 --prefix=/mingw --enable-threads --disable-nls
--enable-languages=c,c++,objc,ada,f95 --disable-win32-registry
--disable-shared --enable-sjlj-exceptions
and i686-pc-cygwin
../gcc/configure --prefix=/usr --enable-threads=posix --disable-libgcj
--enable-sjlj-exceptions --with-system-zlib --enable-nls
--disable-libmudflap --enable-version-specific-runtime-libs
--without-included-gettext --disable-shared
--enable-languages=c,c++,java,objc,f95 --disable-win32-registry
with no new regressions.
ChangeLog
PR middle-end/21275, middle-end/21597
* target.h (struct gcc_target): Add valid_dllimport_attribute_p
target hook.
(struct cxx): Add adjust_class_at_definition target hook.
* target-def.h: (TARGET_VALID_DLLIMPORT_ATTRIBUTE_P): New
define,
defaulting to hook_bool_tree_true. Add to TARGET_INITIALIZER
(TARGET_CXX_ADJUST_CLASS_AT_DEFINITION): New define, defaulting
to
hook_void_tree. Add to TARGET_CXX.
* tree.h (struct decl_with_vis): Rename non_addr_const_p field
to
dllimport_flag.
(DECL_NON_ADDR_CONSTANT_P): Replace with DECL_DLLIMPORT_P macro.
* tree.c (merge_dllimport_decl_attributes): Check
DECL_DLLIMPORT_P
instead of attribute. Check for dllexport override. Warn if
inconsistent dll linkage. Don't lose old dllimport if decl has
had had address referenced. Tweak lookup of dllimport
atribute.
(handle_dll_attribute): Check
targetm.valid_dllimport_attribute_p
for target specific rules. Don't add dllimport attribute if
DECL_DECLARED_ONLINE_P. Set DECL_DLLIMPORT_P when adding
dllimportattribute.
(staticp): Replace DECL_NON_ADDR_CONSTANT_P with
DECL_DLLIMPORT_P.
* config.gcc (i[34567]86-*-cygwin*): Add winnt-cxx.o to
'cxx_target_objs', winnt-stubs,o to 'extra_objs'.
(i[34567]86-*-mingw32*): Likewise.
* doc/tm.texi (TARGET_CXX_ADJUST_CLASS_AT_DEFINITION): Document.
(TARGET_VALID_DLLIMPORT_ATTRIBUTE_P): Document.
* config/i386/winnt.c (i386_pe_dllimport_p): Factor out
C++-specific code. Change return value to bool.
(i386_pe_dllimport_p): Likewise.
(associated_type): Simplify and make language-independent
(i386_pe_encode_section_info): Replace override of ambiguous
dllimport symbol refs with a gcc_assert.
(i386_pe_valid_dllimport_attribute_p): Define.
* config/i386/winnt-cxx.c: New file. Define C++ versions of
i386_pe_type_dllimport_p, i386_pe_type_dllexport_p,
i386_pe_adjust_class_at_definition.
* config/i386/winnt-stubs.c: New file. Define stub versions of
lang-specific functions.
* config/i386/i386-protos.h: Declare winnt-[cxx|stubs].c
functions
i386_pe_type_dllimport_p, i386_pe_type_dllexport_p,
i386_pe_adjust_class_at_definition.
(i386_pe_valid_dllimport_attribute_p): Declare.
* config/i386/cygming.h (TARGET_VALID_DLLIMPORT_ATTRIBUTE_P):
Define.
(TARGET_CXX_ADJUST_CLASS_AT_DEFINITION): Define.
* config/i386/t-cygming: Add rules for winnt-cxx.o,
winnt-stubs.o.
PR target/19704
* config/i386/i386.c (ix86_function_ok_for_sibcall): Replace
test for
dllimport attribute with test of DECL_DLLIMPORT_P.
cp/ChangeLog
PR middle-end/21275, middle-end/21597
* class.c (finish_struct_1): Call
targetm.cxx.adjust_class_at_definition.
testsuite/ChangeLog
* gcc.dg/dll-2.c: Add tests for warnings.
* gcc.dg/dll-3.c: Likewise.
* gcc.dg/dll-4.c: Likewise.
* g++.dg/ext/dllimport1.C: Adjust tests for warnings.
* g++.dg/ext/dllimport2.C: Likewise.
* g++.dg/ext/dllimport3.C: Likewise.
* g++.dg/ext/dllimport7.C: Likewise.
* g++.dg/ext/dllimport8.C: Likewise.
* g++.dg/ext/dllimport9.C: Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dlliport-20051011.diff
Type: application/octet-stream
Size: 49814 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20051011/540cd066/attachment.obj>
More information about the Gcc-patches
mailing list