News for hackers. Stuff that matters.
Re:Ill-Advised C++ Rant, Part 2 (2016) by tlb on Wednesday October 25, 2017 @03:54PM (#15553520)
> objcopy -I binary -O elf64-x86-64 -B i386:x86-64:intel in.bin out.o

Neat! In the past I've used perl scripts to munge into C source.

FYI, it generates symbols named after the filename:

  tlb@london:~/ur$ objcopy -I binary -O elf64-x86-64 -B i386:x86-64:intel /etc/services services.o
  tlb@london:~/ur$ objdump -t services.o

  SYMBOL TABLE:
  0000000000000000 l    d  .data	0000000000000000 .data
  0000000000000000 g       .data	0000000000000000 _binary__etc_services_start
  0000000000004c95 g       .data	0000000000000000 _binary__etc_services_end
  0000000000004c95 g       *ABS*	0000000000000000 _binary__etc_services_size
And in C++ you can get the contents with:

  extern const char _binary__etc_services_start;
  extern const char _binary__etc_services_end;
  string services(&_binary__etc_services_start, &_binary__etc_services_end);

There are no comments on this comment yet.