32-bit in-tree Polly build with CMake

Hi,

I was having troubles building LLVM with Polly in-tree using CMake
with LLVM_BUILD_32_BITS on. Turns out CMake considers LLVMPolly a
module, not a shared library, and LLVM_BUILD_32_BITS only makes
provisions for the EXE and SHARED linker flags.

Possible fixes (pick one):

1. Change cmake/modules/HandleLLVMOptions.cmake to append -m32 to
CMAKE_MODULE_LINKER_FLAGS as well if LLVM_BUILD_32_BITS is set.
2. Change $POLLY/CMakeLists.txt not to use MODULE in add_polly_library.

Should I make an entry in Bugzilla about this or is a post to the
mailing list sufficient? I confess I'm not very familiar with the
organizational aspects of the LLVM project.

Cheers,
~~ Ondra

Hi,

I was having troubles building LLVM with Polly in-tree using CMake
with LLVM_BUILD_32_BITS on. Turns out CMake considers LLVMPolly a
module, not a shared library, and LLVM_BUILD_32_BITS only makes
provisions for the EXE and SHARED linker flags.

Hi,

thanks for reporting.

== Some bug reporting advice ==

In this case, posting to the mailing list was the best option, as it seems some discussion might be helpful and the discussion may even allow you to fix the problem yourself.

In general, creating a bug report is preferred if:

1. You cannot fix the bug yourself and/or you don't have time to fix it

2. Fixing the bug will take time

When looking into a bug and/or discussing it, it may turn out that fixing the bug is complicated. It may either depend on fixing some other bugs or a larger change is required that cannot be done directly.

In both cases it is good to document the bug.

For now, you don't need to open the bug. Let's see if we can solve the problem right ahead?

=== To the problem itself ===

First of all, is this problem platform specific?
We have a 32bit buildbot [1] and it does not report any problems. Do you understand why.

> Possible fixes (pick one):
>
> 1. Change cmake/modules/HandleLLVMOptions.cmake to append -m32 to
> CMAKE_MODULE_LINKER_FLAGS as well if LLVM_BUILD_32_BITS is set.
> 2. Change $POLLY/CMakeLists.txt not to use MODULE in add_polly_library.

I would go for option 1 as Polly itself is used not as a shared library, but as a module. Would you be able to provide a patch?

Tobi

[1] http://lab.llvm.org:8011/builders/polly-intel32-linux/builds/1176

First of all, is this problem platform specific?
We have a 32bit buildbot [1] and it does not report any problems. Do you
understand why.

I think so. This is an i?86 build on a x86_64 machine, i.e. with -m32.
(gcc specifically, but I am sure that clang would raise the same
issue, since this is about passing (or not passing) the correct flags
to the linker. The LLVM_BUILD_32_BITS option seems to be the canonical
way to request an i?86 build on a x86_64 machine when using CMake to
build LLVM.)

I would go for option 1 as Polly itself is used not as a shared library, but
as a module. Would you be able to provide a patch?

Sure; I have attached it.

Cheers,
~~ Ondra

llvm-build32bits-module-m32.patch (579 Bytes)

Thanks. Committed as 158195.

Cheers
Tobi