Backport #8216

Request of backport of fix for Bug #8169

Added by David Edelsohn about 1 year ago. Updated 8 months ago.

[ruby-core:53979]
Status:Closed
Priority:Normal
Assignee:Usaku NAKAMURA

Description

Changesets r39958 and r39989 are needed on Ruby 1.9.3 branch for mkmf to properly test features on AIX.


Related issues

Related to Backport200 - Backport #8169: mkmf generates inaccurate conftest.c test files Closed 03/27/2013

Associated revisions

Revision 40715
Added by Usaku NAKAMURA 11 months ago

merge revision(s) 39958,39989: [Backport #8216]

* lib/mkmf.rb (MAIN_DOES_NOTHING): force to refer symbols for tests
  to be preserved.   [Bug #8169]

* lib/mkmf.rb (MAIN_DOES_NOTHING): ensure symbols for tests to be
  preserved.   [Bug #8169]

History

#1 Updated by Usaku NAKAMURA about 1 year ago

  • Status changed from Open to Assigned
  • Assignee set to Usaku NAKAMURA

#2 Updated by Usaku NAKAMURA 11 months ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r40715.
David, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merge revision(s) 39958,39989: [Backport #8216]

* lib/mkmf.rb (MAIN_DOES_NOTHING): force to refer symbols for tests
  to be preserved.   [Bug #8169]

* lib/mkmf.rb (MAIN_DOES_NOTHING): ensure symbols for tests to be
  preserved.   [Bug #8169]

#3 Updated by Robert Grimm 8 months ago

Ruby 1.9.3's mkmf.rb generates an incorrect conftest.c with this change and results in a "main is undeclared" error.

As is, 1.9.3 will generate something like:
#include "ruby.h"

/top/

int t() { void ((volatile p)()); p = (void (()()))main; return 0; }

int main(int argc, char **argv)

{

if (argc > 1000000) {

printf("%p", &t);

}

return 0;

}

The t() function should be defined under main's definition and t() should be declared at the top. Ruby 2.0.0's mkmf.rb generates something like (which is correct):
#include "ruby.h"

/top/

extern int t(void);

int main(int argc, char **argv)

{

if (argc > 1000000) {

printf("%p", &t);

}

return 0;

}
int t() { void ((volatile p)()); p = (void (()()))main; return 0; }

Also available in: Atom PDF