如何使C ++程序与AIX上的gcc堆栈保护器功能链接? [英] How do I get C++ programs to link with gcc's stack protector feature on AIX?

查看:132
本文介绍了如何使C ++程序与AIX上的gcc堆栈保护器功能链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是AIX新手。我正在尝试使用gcc的堆栈保护器功能来编译程序。我使用pware的GCC软件包在服务器上安装了gcc,并且可以编译以下示例程序:

  #include< stdio.h> 

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

返回0;
}

虽然我打开堆栈保护器后却得到:
g ++ -fstack-protector-all main.cpp
collect2:找不到库libssp_nonshared



我一直在Google上寻找解决方案,看来就像我的libc需要在我的矿井中内置一些东西。



g ++ -v返回



<$ p是否有包含带有内置堆栈保护的libc的软件包? $ p> 使用内置规格。
目标:powerpc-ibm-aix5.3.0.0
配置为:../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
线程模型:aix
gcc版本4.2.4

我在系统上找不到libssp_nonshared.a-是否需要安装其他软件包还是应该与gcc软件包一起提供?

解决方案

这与 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 )不适用于您的平台。抱歉:-(


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?

解决方案

This has nothing to do with libc: your GCC installation is missing libssp_nonshared.a library.

What does your "gcc --version" say? It may have been configured with --disable-libssp option (in which case you can't use the stack protection instrumentation).

Update:
I just looked in gcc-4.3.0/configure:

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

I am about 99% sure this means that libssp (and therefore -fstack-protector) is not available for your platform. Sorry :-(

这篇关于如何使C ++程序与AIX上的gcc堆栈保护器功能链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆