* "causes a section type conflict"
@ 2010-03-10 10:36 Dukextra
2010-03-10 16:39 ` Ian Lance Taylor
0 siblings, 1 reply; 7+ messages in thread
From: Dukextra @ 2010-03-10 10:36 UTC (permalink / raw)
To: gcc-help
Hi
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.
--
View this message in context: http://old.nabble.com/%22causes-a-section-type-conflict%22-tp27847975p27847975.html
Sent from the gcc - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: "causes a section type conflict"
2010-03-10 10:36 "causes a section type conflict" Dukextra
@ 2010-03-10 16:39 ` Ian Lance Taylor
2010-03-10 16:50 ` Axel Freyn
0 siblings, 1 reply; 7+ messages in thread
From: Ian Lance Taylor @ 2010-03-10 16:39 UTC (permalink / raw)
To: Dukextra; +Cc: gcc-help
Dukextra <mahuhta@gmail.com> writes:
> 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.
Ian
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: "causes a section type conflict"
2010-03-10 16:39 ` Ian Lance Taylor
@ 2010-03-10 16:50 ` Axel Freyn
2010-03-11 5:13 ` Dukextra
0 siblings, 1 reply; 7+ messages in thread
From: Axel Freyn @ 2010-03-10 16:50 UTC (permalink / raw)
To: gcc-help
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: "causes a section type conflict"
2010-03-10 16:50 ` Axel Freyn
@ 2010-03-11 5:13 ` Dukextra
2010-03-16 14:48 ` Ian Lance Taylor
0 siblings, 1 reply; 7+ messages in thread
From: Dukextra @ 2010-03-11 5:13 UTC (permalink / raw)
To: gcc-help
Axel Freyn wrote:
>
> 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
>
>
Hi
My GCC is 4.4.1 and target is PowerPC. ld-version is 2.19.1. Same problem
causes with GCC-version 2.95.3.
First of all. I am trying to put these functions to specified section in rom
(.defined_section). Then in linker script I put/map these functions to ram
memory like this.
MEMORY
{
.
.
.
defined_section: org = 0x10000, len = 0xFFFF
section_in_rom: org = 0x4F0000, len = 0xFFFF
}
SECTION
{
.
.
.
.section_in_rom : AT (0x10000)
{
*(.defined_section)
} > section_in_rom
}
In program I copy these functions from rom to ram.
Eveything of these works fine, but if I add for example one static variable
in function or string parameter (like in example) I get these "causes
section type error".
--
View this message in context: http://old.nabble.com/%22causes-a-section-type-conflict%22-tp27847975p27859408.html
Sent from the gcc - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: "causes a section type conflict"
2010-03-11 5:13 ` Dukextra
@ 2010-03-16 14:48 ` Ian Lance Taylor
2010-03-25 11:40 ` Dukextra
0 siblings, 1 reply; 7+ messages in thread
From: Ian Lance Taylor @ 2010-03-16 14:48 UTC (permalink / raw)
To: Dukextra; +Cc: gcc-help
Dukextra <mahuhta@gmail.com> writes:
> My GCC is 4.4.1 and target is PowerPC. ld-version is 2.19.1. Same problem
> causes with GCC-version 2.95.3.
Thanks. Now for the rest of it. Please give us a complete standalone
test case. Please show us the exact output of the linker.
Ian
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: "causes a section type conflict"
2010-03-16 14:48 ` Ian Lance Taylor
@ 2010-03-25 11:40 ` Dukextra
2010-03-25 15:34 ` Ian Lance Taylor
0 siblings, 1 reply; 7+ messages in thread
From: Dukextra @ 2010-03-25 11:40 UTC (permalink / raw)
To: gcc-help
Ian Lance Taylor-3 wrote:
>
>
> Thanks. Now for the rest of it. Please give us a complete standalone
> test case. Please show us the exact output of the linker.
>
>
Hi
I tried to do the linking so wrong way. I tried to put every C-code
implementations to same section with using __attribute__ command. And that
is wrong.
My orginal problem caused because I was trying to put variables and
functions to same section. I can continue compiling if I put variables to
different section than functions. And later I had to put also consts to
different sections. (My example doesnt show that problem because it doesnt
use attributed variable)
I think that better way to do this is to edit linker script to put defined
files to different memeory.
example:
.sdata :
{
*(EXCLUDE_FILE(*my_object.o) .sdata) /* put every object's .sdata sections
here but not my_object.o*/
} > ram
.sdata_my_section : AT (LOADADDR(.sdata)+SIZEOF(.sdata))
{
*my_object.o(.sdata) /* put only .sdata sections from my_object.o file*/
} > my_own_ram_section
And do this for every section... data, sdata, bss, etc...
BUT
Now I have new problem. How I can make symbols in linker script?
I want to list many files in one symbol like this:
__MY_OBJS = my_file1.o my_file2.o my_file3.o
SECTION
{
.sdata :
{
*(EXCLUDE_FILE(*__MY_OBJS) .sdata)
} > ram
.sdata_hal : AT (LOADADDR(.sdata)+SIZEOF(.sdata))
{
*__MY_OBJS(.sdata)
} > my_own_ram_section
}
Is there any way to do this?
Makefile style $(__MY_OBJS) could be better but that doesnt work too.
Dukex
--
View this message in context: http://old.nabble.com/%22causes-a-section-type-conflict%22-tp27847975p28024536.html
Sent from the gcc - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: "causes a section type conflict"
2010-03-25 11:40 ` Dukextra
@ 2010-03-25 15:34 ` Ian Lance Taylor
0 siblings, 0 replies; 7+ messages in thread
From: Ian Lance Taylor @ 2010-03-25 15:34 UTC (permalink / raw)
To: Dukextra; +Cc: gcc-help
Dukextra <mahuhta@gmail.com> writes:
> Now I have new problem. How I can make symbols in linker script?
> I want to list many files in one symbol like this:
>
>
> __MY_OBJS = my_file1.o my_file2.o my_file3.o
The linker script doesn't have any feature like this. You are
permitted to use wildcards, but there is no way to name a list of
files. Some people do this kind of thing by applying a preprocessor
to the linker script; it can often be as simple as sed.
Ian
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-03-25 13:18 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-10 10:36 "causes a section type conflict" Dukextra
2010-03-10 16:39 ` Ian Lance Taylor
2010-03-10 16:50 ` Axel Freyn
2010-03-11 5:13 ` Dukextra
2010-03-16 14:48 ` Ian Lance Taylor
2010-03-25 11:40 ` Dukextra
2010-03-25 15:34 ` Ian Lance Taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).