我如何获得C ++程序与AIX上的gcc的堆栈保护功能链接?(How do I get C++ pr

2019-10-17 10:18发布

I'm a bit of an AIX newbie. I'm trying to compile a program using gcc's stack protector feature. I installed gcc on server using pware's GCC package and I can compile a sample program like:

#include <stdio.h>

int main(int argc,char **argv)
{
  printf("hello world\n");

  return 0;
}

When I turn on stack-protector though, I get: g++ -fstack-protector-all main.cpp collect2: library libssp_nonshared not found

I've been hunting on google for a solution to this and it seems like my libc needs to have some stuff built into that mine doesn't. Is there a package out there that includes a libc with the stack protection builtin?

g++ -v returns

Using built-in specs.
Target: powerpc-ibm-aix5.3.0.0
Configured with: ../stage/gcc-4.2.4/configure --disable-shared --enable-threads=posix --prefix=/opt/pware --with-long-double-128 --with-mpfr=/opt/pware --with-gmp=/opt/pware
Thread model: aix
gcc version 4.2.4

I can not find libssp_nonshared.a on the system -- is there an additional package I need to install or should it have come with the gcc package?

Answer 1:

这有没有关系libc :您的GCC安装缺少libssp_nonshared.a库。

什么是你的"gcc --version"说什么? 它可能已被配置为--disable-libssp选项(在这种情况下,你不能使用堆栈保护仪器)。

更新:
我只是看着在gcc-4.3.0/configure

 powerpc-*-aix*)
    noconfigdirs="$noconfigdirs gprof target-libgloss target-libssp ${libgcj}"
    ;;

我99%肯定这意味着libssp(因此-fstack-protector )不适用于您的平台。 抱歉:-(



文章来源: How do I get C++ programs to link with gcc's stack protector feature on AIX?
标签: gcc aix