[LLVMbugs] [Bug 5480] New: lli -force-interpreter tries to lookup symbols that still have \x01 in their name

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Nov 13 05:14:02 PST 2009


           Summary: lli -force-interpreter tries to lookup symbols that
                    still have \x01 in their name
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: timo.lindfors at iki.fi
                CC: llvmbugs at cs.uiuc.edu

Steps to reproduce:
1) cat > testcase.c <<EOF
#define _FILE_OFFSET_BITS 64
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>

int main(int argc, char *argv[]) {
    struct stat fileinfo;

    stat("/etc/motd", &fileinfo);
    printf("%d\n", fileinfo.st_ino);
    return 0;
2) llvm-gcc -c -o testcase.bc -emit-llvm -O2 testcase.c
3) lli -force-interpreter testcase.bc

Expected results:
3) lli runs the program and it prints the inode number of /etc/motd

Actual results:
3) LLVM ERROR: Tried to execute an unknown external function: i32 (i32, i8*, {
i64, i16, i32, i32, i32, i32, i32, i64, i16, i64, i32, i64, { i32, i32 }, {
i32, i32 }, { i32, i32 }, i64 }*)* __xstat64

More info:
1) lli tries to dlsym "\x01__xstat64" but the \x01 in the error message just is
not visible in terminal.
2) distro is debian stable
3) llvm revision is 86985
4) llvm-gcc revision is 86986
5) A very crude patch to fix the issue is

Index: lib/System/DynamicLibrary.cpp
--- lib/System/DynamicLibrary.cpp       (revision 86985)
+++ lib/System/DynamicLibrary.cpp       (working copy)
@@ -70,6 +70,9 @@

 void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) {
+  if (symbolName && symbolName[0] == '\1') {
+      symbolName++;
+  }
   // First check symbols added via AddSymbol().
   if (ExplicitSymbols) {
     std::map<std::string, void *>::iterator I =

but I don't yet understand enough LLVM to figure out where this really should
be done. In Mangler perhaps?

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