News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

.text section

Started by Emil_halim, January 25, 2014, 06:45:37 PM

Previous topic - Next topic

Emil_halim

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.


Vortex

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.
Code it... That's all...

Bitbeisser

Quote from: 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.
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

TimoVJL

Compile and analyze .obj and .exe from this example with and without pragmas.
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);
}
May the source be with you

Emil_halim

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.