Bug 24355 - Executable stack error building Ada
Summary: Executable stack error building Ada
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.0.2
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: build
Depends on:
Blocks:
 
Reported: 2005-10-13 19:30 UTC by The Written Word
Modified: 2005-10-14 08:17 UTC (History)
1 user (show)

See Also:
Host:
Target: hppa2.0w-hp-hpux11.23
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description The Written Word 2005-10-13 19:30:58 UTC
I tried building Ada from a bootstrap binary found on the net. HP-UX 11.23 unlike 11.00 and 11i, doesn't allow executing code on the stack by default. To enable this for individual binaries:
  $ chatr +es enable [binary]

To enable execution of code on the stack system-wide, the executable_stack kernel tunable needs to be 1 or 2. The default is 0 (disallow execution).

While building 4.0.2, I encountered the following:
  ...
  stage1/xgcc -Bstage1/ -B/opt/TWWfsw/gcc402/hppa2.0-hp-hpux11.23/bin/ -c -g -O2 -mdisable-indexing     -gnatpg -gnata -I- -I. -Iada -I/opt/build/gcc-4.0.2/gcc/ada /opt/build/gcc-4.0.2/gcc/ada/ada.ads -o ada/ada.o
  Execution of code located on a program's stack is not permitted.
  cmd: stage1/gnat1 -I- -I. -Iada -I/opt/build/gcc-4.0.2/gcc/ada -quiet -dumpbase ada.ads -O2 -g -mdisable-indexing -gnatpg -gnata -gn
  PID 24258 has been terminated.  See the '+es enable' option of chatr(1).
  xgcc: Internal error: Killed (program gnat1)
  Please submit a full bug report.
  See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Andrew Pinski 2005-10-13 19:36:13 UTC
This also effects some C code too like:

int f(int (*fptr)(void))
{
  return fptr();
}


int main(void)
{
  int t;
  int g(void){ return t; }
  t = 2;
  f(&g);
}

Compile at -O0 and you will see that it fails too.
Comment 2 Arnaud Charlet 2005-10-14 08:17:17 UTC
There is no bug here, you found the solution which is to modify the settings
of your OS.

Arno