There are strings in my executable that I didn’t put in the source

Asked

Viewed 82 times

0

I compile a very simple program, which has no string literals. It only deals with mathematics.

Then, when examining the contents of the executable I see things like this, even if I have not typed anything like this in my code:

crtstuff.cderegister_tm_clones__do_global_dtors_auxcompleted.7697__do_global_dtors_aux_fini_array_entryframe_dummy__frame_dummy_init_array_entryGame.cASlash__FRAME_END____init_array_end_DYNAMIC__init_array_start__GNU_EH_FRAME_HDR_GLOBAL_OFFSET_TABLE___libc_csu_finigetenv@@GLIBC_2.2.5_ITM_deregisterTMCloneTablestrcpy@@GLIBC_2.2.5ConfigDataputs@@GLIBC_2.2.5_edatastrlen@@GLIBC_2.2.5__stack_chk_fail@@GLIBC_2.4__libc_start_main@@GLIBC_2.2.5__data_start__gmon_start____dso_handle_IO_stdin_used__libc_csu_init__bss_startmainstrcat@@GLIBC_2.2.5__TMC_END___ITM_registerTMCloneTable__cxa_finalize@@GLIBC_2.2.5.symtab.strtab.shstrtab.interp.note.ABI-tag.note.gnu.build-id.gnu.hash.dynsym.dynstr.gnu.version.gnu.version_r.rela.dyn.rela.plt.init.plt.got.text.fini.rodata.eh_frame_hdr.eh_frame.init_array.fini_array.dynamic.data.bss.comment

The compiled code should only be raw instructions, so why all strings?

And global variable names are stored. Also why variable names are stored if they are global variables?

  • 3

    There is the "strip" flag and command in most C compiler "kits", which removes most of the information from debug. In addition, there are things that are part of the standard library (stdlib), which contains the essential functions that your program can use. There are more things too, which serve to structure the executable for the target platform, as well as other references to Linker, depending on how it generated (but I just wanted to advance the subject, until someone responds more extensively).

  • 1

    Has how to put the code, compiler version and command used to compile ?

  • This is information used by Linker. Generally, about variable names and functions, memory allocation, debug. etc.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.