https://sourceware.org/bugzilla/show_bug.cgi?id=34711

            Bug ID: 34711
           Summary: -r and -i option on certain ELF executables lead to
                    internal error
           Product: binutils
           Version: 2.47
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: mullerdome at yahoo dot de
  Target Milestone: ---

Created attachment 17058
  --> https://sourceware.org/bugzilla/attachment.cgi?id=17058&action=edit
ELF executable that is susceptible to the described erroneous behavior

When using ld -r (or -i) on a previously with as and ld created ELF executable
from x86-64 assembler, an internal error occurs.

I reproduced this on WSL Ubuntu 22.04.5 LTS with binutils 2.46.1 and
2.47.50.20261006 (64-bit)

It does not occur with binutils 2.38

1) Create a simple Assembler file like:
.intel_syntax noprefix
.global _start
_start:
mov rdi, 0
mov rax, 60
syscall

(test.s)

2) Assemble it (I used 2.38 as mostly since it is my system installation, but
happened with 2.46 also)

as -o test.o test.s

3) Link the single object file to an executable

ld -o test test.o

4) ld -r test

For me it yields the following output:
"> internal error: aborting at ../../ld/ldlang.c:11464 in
cmdline_check_object_only_section
 > please report this bug"

2.38 ld yields following output instead:
"cannot use executable file 'test' as input to a link"

The ELF executable has the following 'file' output:
"ELF 64-bit LSB executable, x86-64, version 1(SYSV), statically linked, not
stripped"

An executable created by e.g. gcc from a simple c-file does not yield an
executable susceptible to this. So far I only had that with as.


You may ask what my use-case is, that I found that: I simply mistyped -o and
had -i and then got that error, I then tried to strip it down to the minimum
working example.

Error first occured on an unknown system I was connected to via novnc on
pwn.college. I then reproduced it on my Windows 11 computer with the specified
Ubuntu WSL version.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to