I've tried the following, but the resulting file is still an ELF and not purely the section content.
$ objcopy --only-section=<name> <infile> <outfile>
I just want the contents of the section. Is there any utility that can do this? Any ideas?
...
#include <stdio.h>
const int str[1000] = {0};
int main(void)
{
printf("arr is %d\n", str[0]);
return 0;
}
Has the following output:
[-exercises/adam/stack2]:size a.out
text data bss dec hex filename
5133 272 24 5429 1535 a.out
Whereas:
#include <stdio.h>
static int str[1000] = {0};
in...
Assume the x86 64 and linux platform.
If you look into the ELF header, the offset are all 64bit.
So it's easy to create an object file larger than 4G with relocatoin R_X86_64_64. This means a static .o file and executable can be as large as 64bit can represent.
However, for shared library, like gcc , we only have R_X86_64_PLT32 reloca...
Suppose I have an ELF binary that's dynamic linked, and I want to override/redirect certain library calls. I know I can do this with LD_PRELOAD, but I want a solution that's permanent in the binary, independent of the environment, and that works for setuid/setgid binaries, none of which LD_PRELOAD can achieve.
What I'd like to do is add...