Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot recompile assembled code[BUG] #31

Open
ha2san opened this issue Mar 5, 2022 · 2 comments
Open

Cannot recompile assembled code[BUG] #31

ha2san opened this issue Mar 5, 2022 · 2 comments
Assignees
Labels
analysis-needed This issue needs analysis and possible research to solve. bug Something isn't working

Comments

@ha2san
Copy link

ha2san commented Mar 5, 2022

When I try to compile the assembled code I get this error

(retro) bash-5.1$ file binary/quich
binary/quich: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV),
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2,
BuildID[sha1]=f78f9f350f2b849566bbc2062e349729a5493eba, for GNU/Linux 4.4.0,
with debug_info, not stripped

(retro) bash-5.1$ retrowrite binary/quich asm/quich_reassembled.s
.init_array frame_dummy pointer removed.
[*] Relocations for a section that's not loaded: .rela.dyn
[*] Relocations for a section that's not loaded: .rela.plt
[x] Couldn't find valid section ade0
[x] Couldn't find valid section afd8
[x] Couldn't find valid section afe0
[x] Couldn't find valid section afe8
[x] Couldn't find valid section aff0
[x] Couldn't find valid section aff8

(retro) bash-5.1$ gcc asm/quich_reassembled.s -lm -o binary/quich_reassembled
asm/quich_reassembled.s: Assembler messages:
asm/quich_reassembled.s:4898: Error: unrecognized symbol type "GLIBC_2.2.5_b220"
asm/quich_reassembled.s:4898: Error: junk at end of line, first unrecognized character is `,'
asm/quich_reassembled.s:4899: Error: junk at end of line, first unrecognized character is `@'
asm/quich_reassembled.s:4900: Error: invalid character '@' in mnemonic
asm/quich_reassembled.s:4936: Error: unrecognized symbol type "GLIBC_2.2.5_b230"
asm/quich_reassembled.s:4936: Error: junk at end of line, first unrecognized character is `,'
asm/quich_reassembled.s:4937: Error: junk at end of line, first unrecognized character is `@'
asm/quich_reassembled.s:4938: Error: invalid character '@' in mnemonic
asm/quich_reassembled.s:4974: Error: unrecognized symbol type "GLIBC_2.2.5_b240"
asm/quich_reassembled.s:4974: Error: junk at end of line, first unrecognized character is `,'
asm/quich_reassembled.s:4975: Error: junk at end of line, first unrecognized character is `@'
asm/quich_reassembled.s:4976: Error: invalid character '@' in mnemonic

Steps To Reproduce:

Source code can be found at https://github.com/Usbac/quich, I added -pie to the
CFLAGS to make sure that the binary is compiled as position independent code
(PIE). Adding or removing the -g flags does not change anything.

Environment:

OS: 5.14.21-2-MANJARO x86_64 GNU/Linux
GCC: gcc (GCC) 11.2.0
retrowrite at commit: 117dad5

@ha2san ha2san added analysis-needed This issue needs analysis and possible research to solve. bug Something isn't working labels Mar 5, 2022
@ha2san
Copy link
Author

ha2san commented Mar 6, 2022

one of the errors seems for example to come from this line:

.type	stdout@GLIBC_2.2.5_b220,@object

@diagprov diagprov self-assigned this Mar 7, 2022
@Akira-u
Copy link

Akira-u commented Mar 28, 2022

Hi ha2san! I have met the same problem as you on aarch64 and gcc 9.4.0. I solved the problem with delete all the @GLIBC_*** in the .s files. Here's the command: sed -i 's/@GLIBC_2.17//g' $AS_FILE.s.
Hope this helps :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analysis-needed This issue needs analysis and possible research to solve. bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants