$llvm-objcopy --dump-section=.llvmcmd=test_sqrt.bc test_sqrt
llvm-objcopy: error: Link field value 31 in section .rela.plt is not a symbol table
$file test_sqrt
test_sqrt: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 3.2.0, not stripped
$ llvm-objcopy --dump-section=.llvmbc=test_sqrt.bc test_sqrt
$ llvm-objcopy --dump-section=.llvmcmd=test_sqrt.cmd test_sqrt
$ file test_sqrt
test_sqrt: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, not stripped
$ ls
test_sqrt test_sqrt.bc test_sqrt.cmd
How do I compile the llvmbc segment using llvmcmd of an executable program?
Is the bc segment of the executable program before optimization?
$ objdump -h test_sqrt
test_sqrt: file format elf64-x86-64
Sections: Idx Name Size VMA LMA File off Algn 0 .note.gnu.property 00000020 00000000004002a8 00000000004002a8 000002a8 23 CONTENTS, ALLOC, LOAD, READONLY, DATA 1 .note.ABI-tag 00000020 00000000004002c8 00000000004002c8 000002c8 22 CONTENTS, ALLOC, LOAD, READONLY, DATA 2 .rela.plt 00000240 00000000004002e8 00000000004002e8 000002e8 23 CONTENTS, ALLOC, LOAD, READONLY, DATA 3 .init 0000001b 0000000000401000 0000000000401000 00001000 22 CONTENTS, ALLOC, LOAD, READONLY, CODE 4 .plt 000000c0 0000000000401020 0000000000401020 00001020 23 CONTENTS, ALLOC, LOAD, READONLY, CODE 5 .text 00094f18 0000000000401100 0000000000401100 00001100 26 CONTENTS, ALLOC, LOAD, READONLY, CODE 6 libc_freeres_fn 000014cd 0000000000496020 0000000000496020 00096020 24 CONTENTS, ALLOC, LOAD, READONLY, CODE 7 .fini 0000000d 00000000004974f0 00000000004974f0 000974f0 22 CONTENTS, ALLOC, LOAD, READONLY, CODE 8 .rodata 0001cb2c 0000000000498000 0000000000498000 00098000 25 CONTENTS, ALLOC, LOAD, READONLY, DATA 9 .stapsdt.base 00000001 00000000004b4b2c 00000000004b4b2c 000b4b2c 20 CONTENTS, ALLOC, LOAD, READONLY, DATA 10 .eh_frame_hdr 0000211c 00000000004b4b30 00000000004b4b30 000b4b30 22 CONTENTS, ALLOC, LOAD, READONLY, DATA 11 .eh_frame 0000b938 00000000004b6c50 00000000004b6c50 000b6c50 23 CONTENTS, ALLOC, LOAD, READONLY, DATA 12 .gcc_except_table 00000106 00000000004c2588 00000000004c2588 000c2588 20 CONTENTS, ALLOC, LOAD, READONLY, DATA 13 .tdata 00000020 00000000004c37b0 00000000004c37b0 000c27b0 23 CONTENTS, ALLOC, LOAD, DATA, THREAD_LOCAL 14 .tbss 00000048 00000000004c37d0 00000000004c37d0 000c27d0 23 ALLOC, THREAD_LOCAL 15 .init_array 00000008 00000000004c37d0 00000000004c37d0 000c27d0 23 CONTENTS, ALLOC, LOAD, DATA 16 .fini_array 00000008 00000000004c37d8 00000000004c37d8 000c27d8 23 CONTENTS, ALLOC, LOAD, DATA 17 .data.rel.ro 00003788 00000000004c37e0 00000000004c37e0 000c27e0 25 CONTENTS, ALLOC, LOAD, DATA 18 .got 00000098 00000000004c6f68 00000000004c6f68 000c5f68 23 CONTENTS, ALLOC, LOAD, DATA 19 .got.plt 000000d8 00000000004c7000 00000000004c7000 000c6000 23 CONTENTS, ALLOC, LOAD, DATA 20 .data 000019e0 00000000004c70e0 00000000004c70e0 000c60e0 25 CONTENTS, ALLOC, LOAD, DATA 21 __libc_subfreeres 00000048 00000000004c8ac0 00000000004c8ac0 000c7ac0 23 CONTENTS, ALLOC, LOAD, DATA 22 libc_IO_vtables 00000768 00000000004c8b20 00000000004c8b20 000c7b20 25 CONTENTS, ALLOC, LOAD, DATA 23 __libc_atexit 00000008 00000000004c9288 00000000004c9288 000c8288 23 CONTENTS, ALLOC, LOAD, DATA 24 .bss 00005980 00000000004c92a0 00000000004c92a0 000c8290 25 ALLOC 25 __libc_freeres_ptrs 00000020 00000000004cec20 00000000004cec20 000c8290 23 ALLOC 26 .comment 00000094 0000000000000000 0000000000000000 000c8290 20 CONTENTS, READONLY 27 .llvmbc 000017c8 0000000000000000 0000000000000000 000c8324 20 CONTENTS, READONLY 28 .llvmcmd 00000d27 0000000000000000 0000000000000000 000c9aec 20 CONTENTS, READONLY 29 .note.stapsdt 00001648 0000000000000000 0000000000000000 000ca814 22 CONTENTS, READONLY
$llvm-objcopy --dump-section=.llvmcmd=test_sqrt.bc test_sqrt llvm-objcopy: error: Link field value 31 in section .rela.plt is not a symbol table $file test_sqrt test_sqrt: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 3.2.0, not stripped
$ llvm-objcopy --dump-section=.llvmbc=test_sqrt.bc test_sqrt $ llvm-objcopy --dump-section=.llvmcmd=test_sqrt.cmd test_sqrt $ file test_sqrt test_sqrt: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, not stripped $ ls test_sqrt test_sqrt.bc test_sqrt.cmd
How do I compile the llvmbc segment using llvmcmd of an executable program? Is the bc segment of the executable program before optimization?