[LLVMbugs] [Bug 14545] New: program generated by clang and using with shared library generated by gcc does not work

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Dec 8 09:05:21 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=14545

             Bug #: 14545
           Summary: program generated by clang and using with shared
                    library generated by gcc does not work
           Product: clang
           Version: 3.2
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: awg at embtoolkit.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 9654
  --> http://llvm.org/bugs/attachment.cgi?id=9654
clang preprocessed file

I have a gcc/uClibc based cross compiler toolchain for ARM cortex-a8/soft
float/little endian.
Beside that, I also have clang/llvm cross compiler based on
clang release_32 branch git 9b65aea27ca3f915d8d197db494b4caccc745d3c
llvm release_32 branch git 710e1c519ac303c54015c9d8e9f7e28c76f82d41
compiler-rt not compiled by the build system (because --build != --target ?)

Now I create a test shared library, generated with gcc toolchain, which exports
an extern variable.
I create a test program, generated with clang, which uses the extern variable
exported by the test shared library.

Accessing the external variable exported by the shared library,
from the program generated with clang, always returns 0 (while
it was modified by call to functions from the shared library).

I discover this issue with busybox generated with clang, with the same
environment. Busybox uses extern variable optind from getopt(3) interface,
to parse options passed.
The C library (uClibc), where getopt(3) comes from, was compiled with the
gcc cross compiler.  

Please see attached:
- the test program and the shared library source files
- preprocessed files generated with clang and gcc for the test program
- objdump -S --source generated from clang and gcc of the test program
- readelf -a generated from clang and gcc of the test program
- Makefile to compile the test shared library and program

-- 
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