求指点
]# cat > test_dicmap.cpp <<__EOF
#include <stdio.h>
#include <stdint.h>
extern "C" {
extern const uint8_t _binary_dicmap_bin_start[];
extern const uint8_t _binary_dicmap_bin_end[];
extern const void* _binary_dicmap_bin_size;
}
int main()
{
size_t size = (size_t)&_binary_dicmap_bin_size;
printf("start=%p, end=%p\nend-start=%zd, size=%zd\n",
_binary_dicmap_bin_start,
_binary_dicmap_bin_end,
_binary_dicmap_bin_end - _binary_dicmap_bin_start,
size);
printf("data[0..8]=%02x %02x %02x %02x %02x %02x %02x %02x\n",
_binary_dicmap_bin_start[0], _binary_dicmap_bin_start[1],
_binary_dicmap_bin_start[2], _binary_dicmap_bin_start[3],
_binary_dicmap_bin_start[4], _binary_dicmap_bin_start[5],
_binary_dicmap_bin_start[6], _binary_dicmap_bin_start[7]);
}
__EOF
]# echo helloworld > dicmap.bin
2.
]# objcopy -B i386 -I binary -O elf64-x86-64 dicmap.bin dicmap.o && g++ -o libxxx.so dicmap.o -shared && g++ -L. -lxxx test_dicmap.cpp
3.
]# LD_LIBRARY_PATH=. ./a.out
Actual results:
/usr/bin/ld: warning: type and size of dynamic symbol `_binary_dicmap_bin_end' are not defined
/usr/bin/ld: warning: type and size of dynamic symbol `_binary_dicmap_bin_size' are not defined
/usr/bin/ld: warning: type and size of dynamic symbol `_binary_dicmap_bin_start' are not defined
start=0x601024, end=0x601024
end-start=0, size=6295588
data[0..8]=00 00 00 00 00 00 00 00
Expected results:
end-start=11, size=11
data[0..8]=68 65 6c 6c 6f 77 6f 72
--
FROM 36.110.147.*