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 <exception>
|
||||
|
||||
char var_bss[];
|
||||
char var_bss[20];
|
||||
int ivar_bss;
|
||||
|
||||
char var_data[] = "string in data";
|
||||
int ivar_data = 10;
|
||||
|
||||
const char var_rodata[] = "string in rodata";
|
||||
const int ivar_rodata = 10;
|
||||
|
||||
__attribute__((section(".custom")))
|
||||
char var_custom[] = "string in custom section";
|
||||
|
||||
int main ( void )
|
||||
{try{
|
||||
__attribute__((section(".custom")))
|
||||
int ivar_custom = 10;
|
||||
|
||||
void test()
|
||||
{
|
||||
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;
|
||||
}
|
||||
catch ( const std::exception& e )
|
||||
|
||||
Reference in New Issue
Block a user