[LLVMbugs] [Bug 11180] New: unresolved symbol when taking a local label's address

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 19 09:13:52 PDT 2011


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

           Summary: unresolved symbol when taking a local label's address
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: pageexec at freemail.hu
                CC: llvmbugs at cs.uiuc.edu
            Blocks: 4068


Created an attachment (id=7480)
 --> (http://llvm.org/bugs/attachment.cgi?id=7480)
preprocessed source

clang/llvm has for some time supported local labels that linux makes use of:

#define _THIS_IP_  ({ __label__ __here; __here: (unsigned long)&&__here; })

this support also seems to be partially broken lately, the produced asm
sometimes refers to an unresolved symbol instead of the label's address but
seemingly only when the above macro is used in a static inline function and an
out-of-line body is generated for this function.

the attached case reproduces the problem for the function try_module_get on
linux/amd64. the following command line was used to compile it:

clang -c -nostdinc -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -W
-Wno-unused-parameter -Wno-missing-field-initializers -Wno-self-assign
-Wno-unused-value -Wno-format -mno-sse -Wno-unknown-warning-option
-fcatch-undefined-behavior -fno-strict-aliasing -fno-common
-Werror-implicit-function-declaration -Wno-format-security
-fno-delete-null-pointer-checks -Wno-empty-body -O2 -m64 -march=core2
-mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -pipe
-Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2
-mno-3dnow -Wframe-larger-than=2048 -fno-stack-protector
-Wno-unused-but-set-variable -fno-omit-frame-pointer
-fno-optimize-sibling-calls -g -femit-struct-debug-baseonly -pg
-Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow
-fconserve-stack -o anon_inodes.o anon_inodes.i

the resulting asm shows one inlined body of try_module_get in
anon_inode_getfile with a correct (resolved) reference to within the function
whereas the out-of-line copy has a reference to an unresolved symbol .L<xxx> 
(another, perhaps related, issue is why an out-of-line body was generated in
the first place as the function gets inlined into every caller and its address
is not taken in the given compilation unit as far as i can tell).

PS: since this is the last remaining bug that prevents compiling linux (modulo
the usual patches needed on the linux side), it'd be nice if the fix could be
backported to the 3.0 branch as well.

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