[LLVMbugs] [Bug 3007] New: extern __attribute__((weak)) gets turned into undefined symbol

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sun Nov 2 10:25:08 PST 2008


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

           Summary: extern __attribute__((weak)) gets turned into undefined
                    symbol
           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: edwintorok at gmail.com
                CC: llvmbugs at cs.uiuc.edu


The kernel uses genksyms to generate crcs, include/linux/module.h has this
comment:
/* Mark the CRC weak since genksyms apparently decides not to
 * generate a checksums for some symbols */

/* testcase */
extern void * __attribute__((weak)) __crc_init_mm;
static const unsigned long __kcrctab_init_mm __attribute__((__used__))
__attribute__((section("__kcrctab" "_unused"), unused)) = (unsigned long)
&__crc_init_mm;
int main(void)
{
        return 0;
}

LLVM-gcc output:
$ /home/edwin/llvm-svn/install/bin/llvm-gcc foo.c
/tmp/cc2NMjnF.o:(__kcrctab_unused+0x0): undefined reference to `__crc_init_mm'
collect2: ld returned 1 exit status
$ /home/edwin/llvm-svn/install/bin/llvm-gcc foo.c -c && nm foo.o
0000000000000000 d EH_frame0
                 U __crc_init_mm
0000000000000000 r __kcrctab_init_mm
0000000000000000 T main
0000000000000018 d main.eh

GCC:
$ gcc foo.c
$ gcc -c foo.c && nm foo.o
                 w __crc_init_mm
0000000000000000 r __kcrctab_init_mm
0000000000000000 T main


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