[LLVMbugs] [Bug 13856] New: -dynamic-linker /libexec/ld.elf_so: broken binaries

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Sep 15 23:09:04 PDT 2012


             Bug #: 13856
           Summary: -dynamic-linker /libexec/ld.elf_so: broken binaries
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: NetBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: michael.kostylev at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 9222
  --> http://llvm.org/bugs/attachment.cgi?id=9222
proposed patch

Clang hosted on an amd64 machine fails to build a working i386 binary:
% echo 'int main() { return 0; }' > test.c && clang -m32 test.c && ./a.out ;
echo $?
zsh: exec format error: ./a.out
I compared the gcc -v output to clang. The difference is that gcc passes
/usr/libexec/ld.elf_so to the linker, while clang does
/libexec/ld.elf_so./usr/libexec/ld.elf_so is a symlink to /libexec/ld.elf_so,
but only the former does the job:
% clang -m32 -c test.c && ld --eh-frame-hdr -dynamic-linker
/usr/libexec/ld.elf_so -m elf_i386 -o a.out /usr/lib/i386/crt0.o
/usr/lib/i386/crti.o /usr/lib/i386/crtbegin.o test.o --as-needed -lgcc_s
--no-as-needed -lgcc -lc -lgcc --as-needed -lgcc_s --no-as-needed
/usr/lib/i386/crtend.o /usr/lib/i386/crtn.o && ./a.out ; echo $?

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list