From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8185 invoked by alias); 24 Jun 2009 19:32:04 -0000 Received: (qmail 8139 invoked by uid 48); 24 Jun 2009 19:31:53 -0000 Date: Wed, 24 Jun 2009 19:32:00 -0000 Message-ID: <20090624193153.8138.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c/40528] Add a new ifunc attribute In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "hjl dot tools at gmail dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-06/txt/msg01807.txt.bz2 ------- Comment #6 from hjl dot tools at gmail dot com 2009-06-24 19:31 ------- (In reply to comment #5) > What do you do if the function has arguments, because ifunc shouldn't have > arguments? While C++ has unnamed arguments and you could perhaps enforce them, For unnamed arguments, see ifunc-1.c in http://gcc.gnu.org/bugzilla/attachment.cgi?id=18060 > C does not. How do you handle option 3 with: > __attribute__((ifunc)) int > foo (int a, int b) > { > if (a) return foo_1; > if (b) return foo_2; > return foo_3; > } > ? > [hjl@gnu-6 examples]$ cat x.c int foo_1 (int, int); int foo_2 (int, int); int foo_3 (int, int); __attribute__((ifunc)) int foo (int a, int b) { if (a) return foo_1; if (b) return foo_2; return foo_3; } [hjl@gnu-6 examples]$ make x.s /export/build/gnu/gcc-work/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/gcc-work/build-x86_64-linux/gcc/ -S -o x.s -O2 -Wall -Wextra x.c x.c: In function ‘foo’: x.c:6:1: error: parameter ‘a’ used in indirect function ‘foo’ x.c:6:1: error: parameter ‘b’ used in indirect function ‘foo’ make: *** [x.s] Error 1 [hjl@gnu-6 examples]$ -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40528