Project

General

Profile

Actions

Backport #8169

closed

mkmf generates inaccurate conftest.c test files

Added by edelsohn (David Edelsohn) about 11 years ago. Updated about 11 years ago.


Description

mkmf seems to reproduce some of the functionality of GNU Autoconf, but it can generate test files that do not correctly probe for functionality and do not produce correct results. For example, ext/socket produces one conftest.c that looks like:

1: #include "ruby.h"
2:
3: /top/
4: int main() {return 0;}1: #include "ruby.h"
2:
3: /top/
4: int main() {return 0;}
5: extern int t(void);
6: int t(void) { getifaddrs(); return 0; }

When compiled to create an executable "conftest", there is no reference to function t(). Nothing forces t() to be a visible symbol in the final executable and nothing ensures that the linker preserves the function.

On systems where the linker performs garbage collection, such as AIX by default and GNU ld with --gc-sections, the reference to symbol "t" may be dropped, allowing the undefined reference to "getifaddrs" to be dropped, negating the entire purpose of the link test.

The symbol being tested must be called by / referenced by function main().


Related issues 1 (0 open1 closed)

Related to Backport193 - Backport #8216: Request of backport of fix for Bug #8169Closedusa (Usaku NAKAMURA)04/04/2013Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0