Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <20031124074553.6674.qmail@web21408.mail.yahoo.com> Date: Mon, 24 Nov 2003 18:45:53 +1100 (EST) From: =?iso-8859-1?q?Danny=20Smith?= Subject: RE: Possible bug with __attribute__((alias)) in gcc-3.3 To: cygwin AT cygwin DOT com MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Nicholas wrote: > Hi All, > > Gerrit and I were discussing this off-list, but I thought it appropriate > that I move it to the main list since he has confirmed the problem. > > Here's the problem, programs are segfaulting when the are linked to a > symbol which was aliased using __attribute__((alias)) in a dll. Here is > a small testcase: > > > foo.c: > #include > > int __foo (void) { > printf("foo\r\n"); > return 0; > } > int __attribute__ ((alias("__foo"))) foo (void); > One problem is that you (or gcc) need to tell ld that 'foo' is function, not data. Adding this to file foo.c (after the alias declaration): __asm__ (".def _foo; .scl 2; .type 32; .endef\n"); would do that. That fixes the testcase on mingw anyway. I'm testing a patch now that would make gcc do that too (for aliased functions). However, in general,when you do dllexport with code written in straight assembler, you will need to add a function directive like the one above so that the linker does the right thing. (BTW, you've just reminded me of a similar problem in libffi assembly code that needs to be fixed. Thanks ) Or... The usual windows way would be to put your aliasing for dllexports in a def file. Danny http://personals.yahoo.com.au - Yahoo! Personals New people, new possibilities. FREE for a limited time. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/