我想生成一个可执行文件以便使用Mull对其进行突变。
我已启用位码进行编译和链接。
clang++ -std=c++14 -Isrc -Ideps -Wall -Wextra -Werror -Wno-unused-function \
-Wno-unused-parameter -Wformat -Wformat-security -fstack-protector-strong -fPIE \
-fvisibility=hidden -I/usr/include/jsoncpp -fembed-bitcode -flto -g -fsanitize=cfi \
-fno-sanitize-trap=all -c test/test_dispatcher_error.cc \
-o test/stage/x86_64/obj/test_dispatcher_error.o
...
clang++ -z relro -z now -pie -fembed-bitcode -flto -fsanitize=cfi \
-fno-sanitize-trap=all \
test/stage/x86_64/obj/test_dispatcher_error.o \
stage/x86_64/debug/obj/proto/cloud_gateway.pb.o \
stage/x86_64/debug/obj/proto/common_value.pb.o \
stage/x86_64/debug/obj/proto/edge_analytics.pb.o \
stage/x86_64/debug/obj/proto/edge_applications.pb.o \
stage/x86_64/debug/obj/proto/edge_capabilities.pb.o \
stage/x86_64/debug/obj/proto/edge_command.pb.o \
stage/x86_64/debug/obj/proto/edge_default.pb.o \
stage/x86_64/debug/obj/proto/edge_device_info.pb.o \
stage/x86_64/debug/obj/proto/edge_package.pb.o \
stage/x86_64/debug/obj/proto/http_gateway.pb.o \
stage/x86_64/debug/obj/proto/task_info.pb.o \
stage/x86_64/debug/obj/bootstrap.o stage/x86_64/debug/obj/config.o \
stage/x86_64/debug/obj/adapters/read_adapter.o \
stage/x86_64/debug/obj/adapters/write_adapter.o \
stage/x86_64/debug/obj/adapters/close_adapter.o \
stage/x86_64/debug/obj/dispatcher/task.o \
stage/x86_64/debug/obj/dispatcher/command_task.o \
stage/x86_64/debug/obj/dispatcher/task_builder.o \
stage/x86_64/debug/obj/dispatcher/dispatcher.o \
stage/x86_64/debug/obj/dispatcher/edge_gateway.o \
stage/x86_64/debug/obj/dispatcher/package_task.o \
stage/x86_64/debug/obj/dispatcher/subprocess/command_subprocess.o \
stage/x86_64/debug/obj/dispatcher/subprocess/downloader_subprocess.o \
stage/x86_64/debug/obj/dispatcher/subprocess/exec_subprocess.o \
stage/x86_64/debug/obj/dispatcher/subprocess/subprocess.o \
stage/x86_64/debug/obj/dispatcher/unsupported_task.o \
stage/x86_64/debug/obj/error.o \
stage/x86_64/debug/obj/edge_platform/events.o \
stage/x86_64/debug/obj/system/forkexec.o \
stage/x86_64/debug/obj/system/system_command.o \
stage/x86_64/debug/obj/system/system_file_impl.o \
stage/x86_64/debug/obj/system/system_process_impl.o \
stage/x86_64/debug/obj/system/system_socket_impl.o \
stage/x86_64/debug/obj/ealog.o \
-l:libgtest_main.a -l:libgtest.a -l:libgmock.a -lpthread -ljsoncpp -lprotobuf \
-lstdc++fs -lrt -lsystemd -o test/stage/x86_64/bin/test_dispatcher_error
所有对象都包含位码。
file test/stage/x86_64/obj/test_dispatcher_error.o ... \
stage/x86_64/debug/obj/ealog.o
test/stage/x86_64/obj/test_dispatcher_error.o: LLVM IR bitcode
stage/x86_64/debug/obj/proto/cloud_gateway.pb.o: LLVM IR bitcode
stage/x86_64/debug/obj/proto/common_value.pb.o: LLVM IR bitcode
...
stage/x86_64/debug/obj/ealog.o: LLVM IR bitcode
但是最终的可执行文件没有位码。
$ readelf -S test/stage/x86_64/bin/test_dispatcher_error
There are 43 section headers, starting at offset 0xab1020:
Section Headers:
[Nr] Name Type Address Offset
Size EntSize Flags Link Info Align
[ 0] NULL 0000000000000000 00000000
0000000000000000 0000000000000000 0 0 0
[ 1] .interp PROGBITS 0000000000000270 00000270
000000000000001c 0000000000000000 A 0 0 1
[ 2] .note.ABI-tag NOTE 000000000000028c 0000028c
0000000000000020 0000000000000000 A 0 0 4
[ 3] .dynsym DYNSYM 00000000000002b0 000002b0
0000000000003f00 0000000000000018 A 4 1 8
[ 4] .dynstr STRTAB 00000000000041b0 000041b0
00000000000066ad 0000000000000000 A 0 0 1
[ 5] .gnu.hash GNU_HASH 000000000000a860 0000a860
00000000000003c4 0000000000000000 A 3 0 8
[ 6] .gnu.version VERSYM 000000000000ac24 0000ac24
0000000000000540 0000000000000002 A 3 0 2
[ 7] .gnu.version_r VERNEED 000000000000b164 0000b164
0000000000000200 0000000000000000 A 4 7 4
[ 8] .rela.dyn RELA 000000000000b368 0000b368
000000000004cea8 0000000000000018 A 3 0 8
[ 9] .rela.plt RELA 0000000000058210 00058210
0000000000002d60 0000000000000018 AI 3 11 8
[10] .init PROGBITS 000000000005af70 0005af70
0000000000000017 0000000000000000 AX 0 0 4
[11] .plt PROGBITS 000000000005af90 0005af90
0000000000001e50 0000000000000010 AX 0 0 16
[12] .text PROGBITS 000000000005cde0 0005cde0
00000000001ed790 0000000000000000 AX 0 0 16
[13] .fini PROGBITS 000000000024a570 0024a570
0000000000000009 0000000000000000 AX 0 0 4
[14] .rodata PROGBITS 000000000024a580 0024a580
0000000000022b52 0000000000000000 A 0 0 32
[15] .gcc_except_table PROGBITS 000000000026d0d4 0026d0d4
000000000000feb3 0000000000000000 A 0 0 4
[16] .eh_frame PROGBITS 000000000027cf88 0027cf88
000000000005ef0c 0000000000000000 A 0 0 8
[17] .eh_frame_hdr PROGBITS 00000000002dbe94 002dbe94
00000000000164fc 0000000000000000 A 0 0 4
[18] .tbss NOBITS 00000000002f4180 002f3180
0000000000000028 0000000000000000 WAT 0 0 8
[19] .data.rel.ro.loca PROGBITS 00000000002f4180 002f3180
0000000000000a60 0000000000000000 WA 0 0 32
[20] .fini_array FINI_ARRAY 00000000002f4be0 002f3be0
0000000000000008 0000000000000008 WA 0 0 8
[21] .init_array INIT_ARRAY 00000000002f4be8 002f3be8
0000000000000108 0000000000000000 WA 0 0 8
[22] .data.rel.ro PROGBITS 00000000002f4cf0 002f3cf0
0000000000007fb0 0000000000000000 WA 0 0 16
[23] .dynamic DYNAMIC 00000000002fcca0 002fbca0
0000000000000290 0000000000000010 WA 4 0 8
[24] .got PROGBITS 00000000002fcf30 002fbf30
0000000000000180 0000000000000000 WA 0 0 8
[25] .got.plt PROGBITS 00000000002fd0b0 002fc0b0
0000000000000f38 0000000000000000 WA 0 0 8
[26] .data PROGBITS 00000000002fe000 002fd000
0000000000029441 0000000000000000 WA 0 0 32
[27] .tm_clone_table PROGBITS 0000000000327448 00326448
0000000000000000 0000000000000000 WA 0 0 8
[28] .bss NOBITS 0000000000327480 00326448
0000000000ad3f70 0000000000000000 WA 0 0 64
[29] .comment PROGBITS 0000000000000000 00326448
0000000000000061 0000000000000001 MS 0 0 1
[30] .debug_str PROGBITS 0000000000000000 003264a9
00000000002753e1 0000000000000001 MS 0 0 1
[31] .debug_loc PROGBITS 0000000000000000 0059b88a
0000000000000d7c 0000000000000000 0 0 1
[32] .debug_abbrev PROGBITS 0000000000000000 0059c606
000000000000164e 0000000000000000 0 0 1
[33] .debug_info PROGBITS 0000000000000000 0059dc54
000000000013006f 0000000000000000 0 0 1
[34] .debug_ranges PROGBITS 0000000000000000 006cdcc3
00000000000211c0 0000000000000000 0 0 1
[35] .debug_macinfo PROGBITS 0000000000000000 006eee83
0000000000000001 0000000000000000 0 0 1
[36] .debug_pubnames PROGBITS 0000000000000000 006eee84
000000000012e65b 0000000000000000 0 0 1
[37] .debug_pubtypes PROGBITS 0000000000000000 0081d4df
000000000003b532 0000000000000000 0 0 1
[38] .debug_line PROGBITS 0000000000000000 00858a11
00000000000ab1cd 0000000000000000 0 0 1
[39] .note.gnu.gold-ve NOTE 0000000000000000 00903be0
000000000000001c 0000000000000000 0 0 4
[40] .symtab SYMTAB 0000000000000000 00903c00
0000000000058830 0000000000000018 41 10531 8
[41] .strtab STRTAB 0000000000000000 0095c430
0000000000154a24 0000000000000000 0 0 1
[42] .shstrtab STRTAB 0000000000000000 00ab0e54
00000000000001c8 0000000000000000 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
我链接的库是否还需要包含位码?我是否缺少使位码进入最终可执行文件的选项?