-fPIC warning on every compile on Cygwin

Hi,

I partly built LLVM on Cygwin yesterday and it was fine as far as it went. But after doing a svn update today I am getting the following warning on every compile :-

llvm[3]: Compiling LowerAllocations.cpp for Debug build
/usr/src/llvm/lib/Transforms/Utils/LowerAllocations.cpp:1: warning: -fPIC ignored for target (all code is position independent)

This maybe happening on other targets too.

Aaron

Aaron Gray wrote:

Hi,
  I partly built LLVM on Cygwin yesterday and it was fine as far as it went. But after doing a svn update today I am getting the following warning on every compile :-
  
    llvm[3]: Compiling LowerAllocations.cpp for Debug build
    /usr/src/llvm/lib/Transforms/Utils/LowerAllocations.cpp:1: warning:
    -fPIC ignored for target (all code is position independent)

This maybe happening on other targets too.

Thanks for the report. This is certainly due to my change last night to make LLVM build as PIC by default.

Part of the fix is going to be splitting apart whether we're building PIC and whether we pass in the -fPIC flag. We want to know whether the build is PIC in order to control whether libLTO should be built. On your platform we'll still want to build libLTO but don't want to pass the -fPIC flag.

The other part of the fix I'm not so sure about. How should the build system detect that we're building PIC without the -fPIC flag on this platform?

Nick

Aaron Gray wrote:

Hi,

I partly built LLVM on Cygwin yesterday and it was fine as far as it
went. But after doing a svn update today I am getting the following
warning on every compile :-

llvm[3]: Compiling LowerAllocations.cpp for Debug build
/usr/src/llvm/lib/Transforms/Utils/LowerAllocations.cpp:1: warning:
-fPIC ignored for target (all code is position independent)

This maybe happening on other targets too.

Thanks for the report. This is certainly due to my change last night to
make LLVM build as PIC by default.

I was a little perplex at the warning as I could not ascertain where thery were coming from and could see no obvious commit !:slight_smile:

Out of interest, could you point me to the patch or commit, please.

Part of the fix is going to be splitting apart whether we’re building
PIC and whether we pass in the -fPIC flag. We want to know whether the
build is PIC in order to control whether libLTO should be built. On your
platform we’ll still want to build libLTO but don’t want to pass the
-fPIC flag.

Nice

The other part of the fix I’m not so sure about. How should the build
system detect that we’re building PIC without the -fPIC flag on this
platform?

Looks like configure/autoconf territory. ‘configure’ flashes up that Cygwin supports PIC. See attached config.out file.

Aaron

config.out (15.8 KB)

Aaron Gray wrote:

    Aaron Gray wrote:
     > Hi,
     >
     > I partly built LLVM on Cygwin yesterday and it was fine as far as it
     > went. But after doing a svn update today I am getting the following
     > warning on every compile :-
     >
     > llvm[3]: Compiling LowerAllocations.cpp for Debug build
     > /usr/src/llvm/lib/Transforms/Utils/LowerAllocations.cpp:1:
    warning:
     > -fPIC ignored for target (all code is position independent)
     >
     > This maybe happening on other targets too.

    Thanks for the report. This is certainly due to my change last night to
    make LLVM build as PIC by default.

I was a little perplex at the warning as I could not ascertain where thery were coming from and could see no obvious commit !:slight_smile:
Out of interest, could you point me to the patch or commit, please.

r65019 / r65020:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090216/073983.html
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090216/073984.html

(note: links will change)

Nick

Can you please email me if and when it is fixed :slight_smile:

Thanks,

Aaron

Aaron Gray wrote:

    Aaron Gray wrote:
     >
     > Aaron Gray wrote:
     > > Hi,
     > >
     > > I partly built LLVM on Cygwin yesterday and it was fine as
    far as it
     > > went. But after doing a svn update today I am getting the
    following
     > > warning on every compile :-
     > >
     > > llvm[3]: Compiling LowerAllocations.cpp for Debug build
     > > /usr/src/llvm/lib/Transforms/Utils/LowerAllocations.cpp:1:
     > warning:
     > > -fPIC ignored for target (all code is position
    independent)
     > >
     > > This maybe happening on other targets too.
     >
     > Thanks for the report. This is certainly due to my change
    last night to
     > make LLVM build as PIC by default.
     >
     > I was a little perplex at the warning as I could not ascertain where
     > thery were coming from and could see no obvious commit !:slight_smile:
     >
     > Out of interest, could you point me to the patch or commit, please.

    r65019 / r65020:
    http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090216/073983.html
    http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090216/073984.html

Can you please email me if and when it is fixed :slight_smile:

Should be fixed in r65229: http://llvm.org/viewvc/llvm-project?view=rev&revision=65229

Cygwin is still giving “-fPIC ignored for target (all code is position independent)” warnings :frowning:

I have tried from LLVM svn mainline.

Sorry that I did not get round to trying it earlier.

Aaron

Aaron Gray wrote:

    Aaron Gray wrote:
     >
     > Aaron Gray wrote:
     > >
     > > Aaron Gray wrote:
     > > > Hi,
     > > >
     > > > I partly built LLVM on Cygwin yesterday and it was
    fine as
     > far as it
     > > > went. But after doing a svn update today I am
    getting the
     > following
     > > > warning on every compile :-
     > > >
     > > > llvm[3]: Compiling LowerAllocations.cpp for
    Debug build
     > > > /usr/src/llvm/lib/Transforms/Utils/LowerAllocations.cpp:1:
     > > warning:
     > > > -fPIC ignored for target (all code is position
     > independent)
     > > >
     > > > This maybe happening on other targets too.
     > >
     > > Thanks for the report. This is certainly due to my change
     > last night to
     > > make LLVM build as PIC by default.
     > >
     > > I was a little perplex at the warning as I could not
    ascertain where
     > > thery were coming from and could see no obvious commit !:slight_smile:
     > >
     > > Out of interest, could you point me to the patch or
    commit, please.
     >
     > r65019 / r65020:
     > http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090216/073983.html
     > http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090216/073984.html
     >
     > Can you please email me if and when it is fixed :slight_smile:

    Should be fixed in r65229:
    http://llvm.org/viewvc/llvm-project?view=rev&revision=65229
    <http://llvm.org/viewvc/llvm-project?view=rev&revision=65229&gt;

Cygwin is still giving "-fPIC ignored for target (all code is position independent)" warnings :frowning:

*Really!*

Could you please rig Makefile.rules or something to print out the value of $(LLVM_ON_WIN32) ? The only way I can think of this happening is if that's erroneously false.

Nick

Hi Nick,

I am not famuliar enought with the build system to do this.

Can you give me a resision number to check out before your changes so I can get my code tested.

Then once I have done that I can tackel giving you some valid feedback.

Thanks,

Aaron

You could send me a patch maybe that gives you the required information. I am quite up for doing whatevers required to get Cygwin functioning properly again.

Oh, I am going to try back to r65042.

Cheers,

Aaron

Could you please rig Makefile.rules or something to print out the value
of $(LLVM_ON_WIN32) ? The only way I can think of this happening is if
that's erroneously false.

The configure script sets LLVM_ON_UNIX, not LLVM_ON_WIN32, for Cygwin:

  case $host in
  ...
  *-*-cygwin*)
    llvm_cv_link_all_option="-Wl,--whole-archive"
    llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
    llvm_cv_os_type="Cygwin"
    llvm_cv_platform_type="Unix" ;;

case $llvm_cv_platform_type in
  Unix)

cat >>confdefs.h <<\_ACEOF
#define LLVM_ON_UNIX 1
_ACEOF

    LLVM_ON_UNIX=1

    LLVM_ON_WIN32=0

    ;;

Jay.

Could you please rig Makefile.rules or something to print out the value
of $(LLVM_ON_WIN32) ? The only way I can think of this happening is if
that's erroneously false.

This works for me:

Index: Makefile.rules

Jay, thanks I will try this.

Does it also deal with the lib/Transforms/Hello build failure ?

Many thanks,

Aaron

Jay Foad wrote:

Could you please rig Makefile.rules or something to print out the value
of $(LLVM_ON_WIN32) ? The only way I can think of this happening is if
that's erroneously false.

This works for me:

Index: Makefile.rules

--- Makefile.rules (revision 65633)
+++ Makefile.rules (working copy)
@@ -298,6 +298,8 @@
       # Common symbols not allowed in dylib files
       CXX.Flags += -fno-common
       C.Flags += -fno-common
+ else ifeq ($(OS),Cygwin)
+ # Nothing. Cygwin defaults to PIC and warns when given -fPIC
     else
       # Linux and others; pass -fPIC
       CXX.Flags += -fPIC

Okay. Could someone also test MinGW? Does its gcc emit a warning when passed -fPIC?

Nick

I had to hand modify the code as it did not seem to want to work as a patch.

However, it does not deal with the LLVMHello.dll problem. Here’s what I am getting :-

cygwin-fPIC.patch (467 Bytes)

Nick, could you lease give me a list of all the LTO revision/patches so that I may backpeddle and try to get to the bottom of this.

Thanks,

Aaron

Hi, Nick

Okay. Could someone also test MinGW? Does its gcc emit a warning when
passed -fPIC?

Yes, it should. However, mingw == LLVM_ON_WIN32 :slight_smile:

Please try this patch. I tried to copy exactly what libtool would do on Cygwin by reading the libtool source.

Nick

Aaron Gray wrote:

cygwin1.patch (912 Bytes)

Aaron Gray wrote:

    Please try this patch. I tried to copy exactly what libtool would do
    on Cygwin by reading the libtool source.

Hi Nick,
Working fine on Cygwin :slight_smile:

Great to hear! I've committed the fix in r65922. Thanks for the testing and putting up with the breakage.

Nick