1,
#include <stdio.h>;
int main()
{
FILE *f;
char c;
if ( ( f = fopen( __FILE__, "r" ) ) != NULL ) {
while ( fread( &c, 1, 1, f ) == 1 )
frwite( &c, 1, 1, stdout );
fclose( f );
}
return 0;
}
2,
//test.c#include <stdio.h>extern unsigned char _binary_test_c_start[];int main(){printf("%s/n", _binary_test_c_start);return 0;}#Makefiletest: test.obj test.cgcc -o test test.c test.objtest.obj:test.cobjcopy -I binary -B i386 -O elf32-i386 test.c test.objclean:@-rm test.obj test[liman@localhost book]$ objdump -ht test.objtest.obj: file format elf32-i386Sections:Idx Name Size VMA LMA File off Algn0 .data 00000087 00000000 00000000 00000034 2**0CONTENTS, ALLOC, LOAD, DATASYMBOL TABLE:00000000 l d .data 00000000 .data00000000 g .data 00000000 _binary_test_c_start //资源首地址00000087 g .data 00000000 _binary_test_c_end00000087 g *ABS* 00000000 _binary_test_c_size