NO

Author Topic: .text section  (Read 5879 times)

Emil_halim

  • Guest
.text section
« 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.

 
« Last Edit: January 25, 2014, 06:55:00 PM by Emil_halim »

Offline Vortex

  • Member
  • *
  • Posts: 865
    • http://www.vortex.masmcode.com
Re: .text section
« Reply #1 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.
Code it... That's all...

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 772
Re: .text section
« Reply #2 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

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: .text section
« Reply #3 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);
}
May the source be with you

Emil_halim

  • Guest
Re: .text section
« Reply #4 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.