int var is added to sections.
This commit is contained in:
@@ -5,18 +5,37 @@ VIM: let g:wcppflags="/O2 /EHsc /DWIN32"
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
|
||||||
char var_bss[];
|
char var_bss[20];
|
||||||
|
int ivar_bss;
|
||||||
|
|
||||||
char var_data[] = "string in data";
|
char var_data[] = "string in data";
|
||||||
|
int ivar_data = 10;
|
||||||
|
|
||||||
const char var_rodata[] = "string in rodata";
|
const char var_rodata[] = "string in rodata";
|
||||||
|
const int ivar_rodata = 10;
|
||||||
|
|
||||||
__attribute__((section(".custom")))
|
__attribute__((section(".custom")))
|
||||||
char var_custom[] = "string in custom section";
|
char var_custom[] = "string in custom section";
|
||||||
|
|
||||||
int main ( void )
|
__attribute__((section(".custom")))
|
||||||
{try{
|
int ivar_custom = 10;
|
||||||
|
|
||||||
|
void test()
|
||||||
|
{
|
||||||
const char * var_ptr = "string in rodata 2";
|
const char * var_ptr = "string in rodata 2";
|
||||||
|
|
||||||
std::cout << var_bss << var_data << var_rodata << var_ptr ;
|
std::cout
|
||||||
|
<< var_bss
|
||||||
|
<< var_data
|
||||||
|
<< var_rodata
|
||||||
|
<< var_ptr
|
||||||
|
<< &ivar_custom
|
||||||
|
<< &ivar_rodata ;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main ( void )
|
||||||
|
{try{
|
||||||
|
system("objdump -t elf_sections.exe | grep var");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
catch ( const std::exception& e )
|
catch ( const std::exception& e )
|
||||||
|
|||||||
Reference in New Issue
Block a user