Pelles C forum

C language => Expert questions => Topic started by: Emil_halim on January 25, 2014, 06:45:37 pm

Title: .text section
Post by: Emil_halim on January 25, 2014, 06:45:37 pm
Hi all

How can we force pelles c to put all data and idata in the same .text section?

I mean all things in one code section.

BTW i do not use linker , i merge the obj file directly , so i want it in obj file.

in asm language , i put every thing under .code directive and that works well.   

thanks.

 
Title: Re: .text section
Post by: Vortex on January 25, 2014, 10:25:12 pm
Hi Emil,

Welcome to the forum.

I am afraid that's not possible in Pelles C. In assembly, you can have total control on the sections but that's a different case. You should merge the sections with Polink.
Title: Re: .text section
Post by: Bitbeisser on January 26, 2014, 05:49:42 am
Hi all

How can we force pelles c to put all data and idata in the same .text section?

I mean all things in one code section.

BTW i do not use linker , i merge the obj file directly , so i want it in obj file.

in asm language , i put every thing under .code directive and that works well.   

thanks.
Pelle's C specifically targets Windows as the development target and there is no need for this. You might be better off to look for a development environment that better suit your needs...

Ralf
Title: Re: .text section
Post by: TimoVJL on January 26, 2014, 10:26:22 am
Compile and analyze .obj and .exe from this example with and without pragmas.
Code: [Select]
void __stdcall ExitProcess(int);
int test(void) {
int test1 = 0;
return test1;
}
#pragma data_seg(".text") // set data to .text or _text segment
int itest;
char stest[100] = "stest_stest";
#pragma data_seg()
#pragma comment(linker, "-merge:.data=.text") // merge idata to .text
void __cdecl WinMainCRTStartup(void)
{
test();
ExitProcess(0);
}
Title: Re: .text section
Post by: Emil_halim on January 26, 2014, 05:11:42 pm
thanks for all of you.

@Vortex:

thanks for your welcome.
due to some bugs in creating obj file with c-- , so i have removed Golink and all it's stuff.

@Bitbeisser:

my project is to use pelles c aith c-- , it is a middle point of asm and c coding.  so i used pelles to preduce obj file that directly inserted in c-- ,and c-- will make the rest.

@ timovjl:
I have used this with msvc2010 , and dont know if it is possible with pelles c.
also i see you made an option to the liker     #pragma comment(linker, "-merge:.data=.text")
but i do not use any external linker.