[CMake] CHECK_TYPE_SIZE works incorrectly with LDFLAGS="-Wl, --gc-sections"
Arfrever Frehtes Taifersar Arahesis
arfrever.fta at gmail.com
Wed Aug 6 18:14:38 EDT 2008
2008-08-06 21:05:50 Brad King napisał(a):
> Arfrever Frehtes Taifersar Arahesis wrote:
> > 2008-08-06 14:06:47 Bill Hoffman napisał(a):
> >> Arfrever Frehtes Taifersar Arahesis wrote:
> >>
> >>>> Can you do a find in your build tree and find CMakeError.log?
> >>> `find -name CMakeError.log` doesn't return anything.
> >>>
> >> Can you do this:
> >>
> >> cmake --debug-trycompile
> >>
> >> Then tar up and zip the whole thing and email it to me off the list.
> >
> > It doesn't contain any private data, so I'm attaching it here.
>
> CMake checks the type size by compiling a source file that encodes a
> string literal with the size of the type using the preprocessor. See
> "Modules/CheckTypeSizeC.c.in" for the actual code. Then the string
> literal is parsed out of the compiled file. This avoids needing to run
> the program so the test works for cross compiling.
>
> The trick is to convince the compiler to put the string in the final
> binary. Getting this to happen on all compilers has required a few
> iterations. Basically we have to make sure the program return value
> depends on the data. It looks like we still need a better method to
> prevent the string from being removed by --gc-sections. Try editing
> CheckTypeSizeC.c.in in your CMake installation, and replace the line
>
> return (&info_sizeof[0] != &info_sizeof[0]);
>
> with
>
> return info_sizeof[0];
>
> Then try building your project again.
It seems to work correctly.
Please include this change in the next version of CMake.
--
Arfrever Frehtes Taifersar Arahesis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080807/e911c00c/attachment.pgp>
More information about the CMake
mailing list