[LLVMbugs] [Bug 13221] New: __PIC__ no longer defined when -fPIE is used

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 27 07:32:02 PDT 2012


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

             Bug #: 13221
           Summary: __PIC__ no longer defined when -fPIE is used
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Driver
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: steveire at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


stephen at hal:/tmp/cpp$ clang++ -fPIC main.cpp 
main.cpp:7:9: warning: GOT PIC [-W#pragma-messages]
#pragma message("GOT PIC")
        ^
1 warning generated.                                                            

stephen at hal:/tmp/cpp$ clang++ -fPIE main.cpp 
main.cpp:3:9: warning: GOT PIE [-W#pragma-messages]
#pragma message("GOT PIE")
        ^
1 warning generated.                                                            

stephen at hal:/tmp/cpp$ g++ -fPIE main.cpp 
main.cpp:3:26: note: #pragma message: GOT PIE
main.cpp:7:26: note: #pragma message: GOT PIC

stephen at hal:/tmp/cpp$ clang++ --version
clang version 3.2 
Target: x86_64-unknown-linux-gnu
Thread model: posix

stephen at hal:/tmp/cpp$ g++ --version
g++ (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


stephen at hal:/tmp/cpp$ cat main.cpp 

#ifdef __PIE__
#pragma message("GOT PIE")
#endif

#ifdef __PIC__
#pragma message("GOT PIC")
#endif

int main() { return 0; }



It is not clear if this is intentional or not.

I am told that with 3.0-6ubuntu3 the output is "GOT PIC"

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