This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch lto/c++/middle-end/windows]: Fix handling of dllexport for LTO as externally_visible


On Mon, Nov 29, 2010 at 10:20 PM, Dave Korn <dave.korn.cygwin@gmail.com> wrote:
> On 25/11/2010 12:30, Kai Tietz wrote:
>> 2010/11/24 Jan Hubicka <hubicka@ucw.cz>:
>>>> 2010/11/16 Jan Hubicka <hubicka@ucw.cz>:
>>>>> You need to only update cgraph_externally_visible_p and
>>>>> varpool_externally_visible_p in ipa.c and
>>>>> process_function_and_variable_attributes (that one is missing in your patch and
>>>>> I think it is needed to solve same scenarios as
>>>>> process_function_and_variable_attributes was introduced for).
>>>>>
>>>>> You would need to check the flag on all those places, too and attribute lookup
>>>>> should be cheap given that those functions are called constant amount of times
>>>>> per symbol.
>>>>>
>>>>> Honza
>>>>>
>>>>>
>>>> So here the version using dllexport attribute checking. Testcase as
>>>> provided by prior patch.
>>>>
>>>> Ok for apply?
>>> OK, thanks!
>>> Honza
>>>
>>
>> Applied at ?revision 167144.
>
> ?This code ICEs, as I discovered while building a cygwin-to-mingw
> cross-compiler with shared libjava enabled; it got all the way through to
> libjava without problem, then failed during the libltdl sub-build:
>
>> ?/gnu/gcc/obj-mingw-pr40125/./gcc/xgcc -B/gnu/gcc/obj-mingw-pr40125/./gcc/ -L/gnu/gcc/obj-mingw-pr40125/i686-pc-mingw32/winsup/mingw -L/gnu/gcc/obj-mingw-pr40125/i686-pc-mingw32/winsup/w32api/lib -isystem /gnu/gcc/gcc-patched/winsup/mingw/include -isystem /gnu/gcc/gcc-patched/winsup/w32api/include -B/opt/mingw-new/i686-pc-mingw32/bin/ -B/opt/mingw-new/i686-pc-mingw32/lib/ -isystem /opt/mingw-new/i686-pc-mingw32/include -isystem /opt/mingw-new/i686-pc-mingw32/sys-include -DHAVE_CONFIG_H -I. -I/gnu/gcc/gcc-patched/libjava/libltdl -g -O2 -c /gnu/gcc/gcc-patched/libjava/libltdl/ltdl.c ?-DDLL_EXPORT -DPIC -o .libs/ltdl.o
>> /gnu/gcc/gcc-patched/libjava/libltdl/ltdl.c:4512:1: internal compiler error: Segmentation fault
>> Please submit a full bug report,
>> with preprocessed source if appropriate.
>> See <http://gcc.gnu.org/bugs.html> for instructions.
>> make[4]: *** [ltdl.lo] Error 1
>
> ?The problem is a cut-n-pasto in the second copy of the attribute lookup code:
>
>> @@ -835,7 +842,14 @@
>> ? ? ? ? if (vnode->finalized)
>> ? ? ? ? ? varpool_mark_needed_node (vnode);
>> ? ? ? }
>> - ? ? ?if (lookup_attribute ("externally_visible", DECL_ATTRIBUTES (decl)))
>> + ? ? ?if (TARGET_DLLIMPORT_DECL_ATTRIBUTES
>> + ? ? ? && lookup_attribute ("dllexport", DECL_ATTRIBUTES (decl))
>> + ? ? ? && TREE_PUBLIC (node->decl))
> ? ? ? ? ? ? ? ? ? ? ? ? ?^^^^^^ here.
>> + ? ? {
>> + ? ? ? if (vnode->finalized)
>> + ? ? ? ? varpool_mark_needed_node (vnode);
>> + ? ? }
>> + ? ? ?else if (lookup_attribute ("externally_visible", DECL_ATTRIBUTES (decl)))
>
> ?The first time cgraph_analyze_functions() calls
> process_function_and_variable_attributes(), both input parameters are null,
> which means that the 'node' variable is null after the first loop, and
> accidentally reusing it here segfaults. ?In fact, even the testcase you added
> ICEs for me ...
>
>> Running /gnu/gcc/gcc-patched/gcc/testsuite/gcc.dg/dg.exp ...
>> FAIL: gcc.dg/dll-8.c (internal compiler error)
>> FAIL: gcc.dg/dll-8.c (test for excess errors)
>> ERROR: gcc.dg/dll-8.c: error executing dg-final: couldn't open "dll-8.s": no
>> such file or directory
>> UNRESOLVED: gcc.dg/dll-8.c: error executing dg-final: couldn't open
>> "dll-8.s": no such file or directory
>
> ?... so please double-check your testing procedures.
>
> gcc/ChangeLog:
>
> 2010-11-29 ?Dave Korn ?<...
>
> ? ? ? ?* cgraphunit.c (process_function_and_variable_attributes): Fix
> ? ? ? ?cut'n'pasteo.
>
> ?OK, I take it?

Ok.

Thanks,
Richard.

> ? ?cheers,
> ? ? ?DaveK
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]