i'm using the tcc compiler to compile the following code:
#include <stdio.h>
#include <string.h>
void main()
{
// intializing the secret code in the secret section.
char* secret __attribute__ ((section(".secret")));
secret = "myKey";
// receive the user input.
char* guess;
printf( "Enter your password\n");
scanf("%s", guess);
// detrmine success
int result = strcmp(secret, guess);
if(!result)
printf( "Success\n" );
else
printf( "Wrong\n" );
}
according to the tcc reference: https://bellard.org/tcc/tcc-doc.html#linker section 3.3, tcc implement the "__ attribute __" GNU extension for C, so after compilation the 'secrect' string should be in a new assembly section. But, when i'm using dumpbin utility on the .exe file it tell me i have only two sections: .text and .data...
Summary
1000 .data
1000 .text
i got this problem even when i'm using existing section like ".text", still the 'secret' stored in ".data"
even with unintialized integers i have no ".bss" section, just ".text" and ".data".
note: i got the last version of tcc.
please help!