Closed Lein-Zhang closed 10 months ago
Hi @Lein-Zhang, thanks for trying DDisasm. The warnings
WARNING: Moving symbol to first block of section: __init_array_end
WARNING: Moving symbol to first block of section: __init_array_start
are typically not a big problem. However, we have had problems in the past when trying to reassemble programs with .ctor
or .dtor
sections (modern linkers try to transform those sections and sometimes they do it wrong). Please take a look at https://github.com/GrammaTech/ddisasm/issues/57. That issue contains the discussion of (what looks like) a similar issue and some possible solutions. Let us know if that does not help.
it worked now ! $ ld --verbose > myscript.T then delete init_array and fini_array section in myscript.T $ gcc tcp.s -nostartfiles -no-pie -lstdc++ -T mysrcipt.T -o tcp_new success recompile tcp.s now !!, Thanks. when i use another way recompile binary ,like this :
` $ ddisasm --ir tcp.gtirb tcp_client
_Building the initial gtirb representation [ 23ms]
Processing module: tcp_new
disassembly load [ 200ms] compute [ 978ms] transform WARNING: Moving symbol to first block of section: __bss_start
[ 121ms]
SCC analysis compute [ 3ms] transform [ 0ms]
no return analysis load [ 6ms] compute [ 68ms] transform [ 0ms]
function inference load [ 15ms] compute [ 6ms] transform [ 4ms]_
$ gtirb-pprinter tcp.gtirb --binary tcp_cli
_[INFO] (/data/binary/gtirb-pprinter/src/gtirb_pprinter/driver/pretty_printer.cpp:262) Reading GTIRB file: "tcp.gtirb"
[INFO] (/data/binary/gtirb-pprinter/src/gtirb_pprinter/driver/pretty_printer.cpp:497) Module tcp_new has integral symbols; attempting to assign referents...
[INFO] (/data/binary/gtirb-pprinter/src/gtirb_pprinter/driver/pretty_printer.cpp:559) Generating binary for module tcp_new
Generating binary file
Compiler arguments: -o /tmp/fileWczfuZ /tmp/fileGLjymX.s -Wl,--no-as-needed -l:libstdc++.so.6 -l:libgcc_s.so.1 -l:libc.so.6 -no-pie -nostartfiles
/usr/bin/ld: warning: cannot create .note.gnu.build-id section, --build-id ignored
/usr/bin/ld: error: /tmp/ccqOkTA5.o: size of section .ctors is not multiple of address size
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
[ERROR] (/data/binary/gtirb-pprinter/src/gtirb_pprinter/ElfBinaryPrinter.cpp:719) assembler returned: 1
[ERROR] (/data/binary/gtirb-pprinter/src/gtirb_pprinter/driver/pretty_printer.cpp:586) Unable to assemble 'tcp_cli'._
` it got error. Thanks.
ooh ! it now worked ,like this
$ gtirb-pprinter -c -T myscript.T --ir tcp.gtirb --binary tcp_new
myscript.T got with ld --version , and delete .init_array and .fini_array #57
when i use dissasm disassemble binary : it got waring like this: $ ddisasm --asm tcp.s tcp_client Building the initial gtirb representation (14ms) Decoding binary: tcp_client (193ms) Disassembling (1s) Populating gtirb representation WARNING: Moving symbol to first block of section: init_array_end WARNING: Moving symbol to first block of section: init_array_start (100ms) Computing intra-procedural SCCs (3ms) Computing no return analysis (87ms) Detecting additional functions (23ms) Printing assembler (111ms) when i want to recompile tcp.s to binary ,i got error $ ldd tcp_client linux-vdso.so.1 (0x00007ffd099cc000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f81a583c000) libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f81a565a000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f81a5573000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f81a5558000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f81a5330000) /lib64/ld-linux-x86-64.so.2 (0x00007f81a5856000) $ gcc tcp.s -no-pie -lpthread -lstdc++ -lm -lc -o tcp_new /usr/local/bin/ld: error: /tmp/ccWV7Ccp.o: size of section .ctors is not multiple of address size /usr/local/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status .ctors in tcp.s is :
i try to repair the .ctors ,it still got error .