From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 86352 invoked by alias); 21 Feb 2016 12:28:20 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 86334 invoked by uid 89); 21 Feb 2016 12:28:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.1 required=5.0 tests=BAYES_50,FREEMAIL_FROM,LIBERO,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS autolearn=no version=3.3.2 spammy=H*R:D*it, H*MI:webmail, H*M:webmail, 0xc X-HELO: libero.it Received: from smtp-32.italiaonline.it (HELO libero.it) (212.48.25.160) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sun, 21 Feb 2016 12:28:18 +0000 Received: from webmail-48.iol.local ([10.255.24.125]) by smtp-32.iol.local with bizsmtp id M0UE1s00D2hwdFu0Y0UExJ; Sun, 21 Feb 2016 13:28:14 +0100 x-libjamoibt: 1601 X-CNFS-Analysis: v=2.1 cv=Ift6Ijea c=1 sm=1 tr=0 a=Rrm7V8oFhlmwWN/lK0VnQA==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=v-ufWWweVTUA:10 a=TUsnnyyE6y8A:10 a=w4O9Kvv5L38A:10 a=IkcTkHD0fZMA:10 a=yEKcN0wXg9gsks4NTVoA:9 a=QEXdDO2ut3YA:10 Message-ID: <2137976859.11219481456057694503.JavaMail.httpd@webmail-48.iol.local> Date: Sun, 21 Feb 2016 12:28:00 -0000 From: Carlo Bramini Reply-To: Carlo Bramini To: cygwin@cygwin.com Subject: LIBGCC startup code: you cannot hide GetProcAddress@8 and GetModuleHandleA@4 MIME-Version: 1.0 Content-Type: text/plain;charset="UTF-8" Content-Transfer-Encoding: 7bit X-SenderIP: 82.52.0.186 X-libjamv: AZBK2vFYPmc= X-libjamsun: hRTD/hvPsLqjyzNu3kSt5j86Vn+JIF6A X-SW-Source: 2016-02/txt/msg00319.txt.bz2 Let's assume to have this simple C source code: void * __stdcall GetProcAddress( int hModule, char * function ) { return 0; } void * __stdcall GetModuleHandleA( char * Module ) { return 0; } int main() { return 0; } if you try to compile it, you will get: /usr/lib/w32api/libkernel32.a(deijs00581.o):(.text+0x0): multiple definition of `GetProcAddress@8' /tmp/ccMGY4R3.o:t.c:(.text+0x0): first defined here /usr/lib/w32api/libkernel32.a(deijs00533.o):(.text+0x0): multiple definition of `GetModuleHandleA@4' /tmp/ccMGY4R3.o:t.c:(.text+0xc): first defined here collect2: error: ld returned 1 exit status In my opinion, it is a bug or, if you prefer, a limitation in the startup code. I think that this happens because gcc/config/i386/cygming-crtbegin.c always uses GetProcAddress() and GetModuleHandleA() API, even when you feed -static option at command line. I understand that there are not too much ways for importing stuff from cyggcc_s-1.dll, but I think this limitation could be also overcome in a simple way. Perhaps, besides crtbegin.o and crtbeginS.o, CYGWIN toolchain should also allow use crtbeginT.o (it seems to me that it is actually missing), for having the real static linking when you provide "-static" on the command line. The source file with an additional #ifdef...#endif will just call __register_frame_info, _Jv_RegisterClasses and __deregister_frame_info functions without much worries. I'm using: gcc version 5.3.0 (GCC) but it also happens with GCC4 Sincerely, Carlo Bramini. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple