From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8023 invoked by alias); 10 Mar 2010 16:50:37 -0000 Received: (qmail 8011 invoked by uid 22791); 10 Mar 2010 16:50:34 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mail.gmx.net (HELO mail.gmx.net) (213.165.64.20) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Wed, 10 Mar 2010 16:50:28 +0000 Received: (qmail invoked by alias); 10 Mar 2010 16:50:20 -0000 Received: from NANO-67-180.grenoble.cnrs.fr (EHLO axel) [147.173.67.180] by mail.gmx.net (mp065) with SMTP; 10 Mar 2010 17:50:20 +0100 Date: Wed, 10 Mar 2010 16:50:00 -0000 From: Axel Freyn To: gcc-help@gcc.gnu.org Subject: Re: "causes a section type conflict" Message-ID: <20100310165013.GS7634@axel> Mail-Followup-To: gcc-help@gcc.gnu.org References: <27847975.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2010-03/txt/msg00153.txt.bz2 Hi Ian, > > I have problem with GNU linker. > > > > I will show you simple example how it appears. But basically if I have set > > one function to specified memory section and try to call function with > > string parameter. then linker says "causes a section type conflict". > > > > > > char FooBar(const char *) __attribute__((section(".defined_section"))); > > void TestFunction(void) __attribute__((section(".defined_section"))); > > > > char FooBar(const char * s) > > { > > if(s) return 1; > > else return 0; > > } > > > > void TestFunction(void) > > { > > FooBar(1); // This works fine > > FooBar("1") // This doesnt work, linker script says: " TestFunction > > causes a section type conflict" > > } > > > > > > So what is that error message? Google didnt find any solve for this. > > I can't find that error message anywhere in the linker. > > What version of gcc? What version of GNU ld? What target? Please > give us a complete standalone test case. Please show us the exact > output of the linker. At least on my machine, this error-message can result from the compiler, not the linker. For the differen file text.c (from the (quite old) discussion http://gcc.gnu.org/ml/gcc/2001-10/msg00707.html): static const int a __attribute__ ((__section__ (".data.init"))) = 1; static int b __attribute__ ((__section__ (".data.init"))) = 1; I obtain: gcc -c test.c test.c:2: error: b causes a section type conflict Maybe the OP also obtains the error from the compiler? However, for me (gcc 4.3.2) his example compiles cleanly (except the missing ";") Axel