AIX Server下面ld C语言出警告 居然不能用%操作
简单的C程序
#include <stdlib.h>
#include <time.h>
typedef struct _RandInfo {
int iMin;
int iMax;
int iRand;
} RandInfo;
void JMYTSXZCRAND(RandInfo *rndInf)
{
int tmp, rnd, bas;
printf( "%d\n ",rndInf-> iMin);
printf( "%d\n ",rndInf-> iMax);
if (rndInf-> iMax > rndInf-> iMin)
{
printf( "if\n ");
tmp = (int)(((rndInf-> iMax) + 1) - (rndInf-> iMin));
printf( "tmp=%d\n ",tmp);
rnd= rand();
printf( "rnd=%d\n ",rnd);
bas = rnd % tmp; /* <--- */
rndInf-> iRand = bas + (rndInf-> iMin);
}
else
rndInf-> iRand = rndInf-> iMin;
}
使用下面的makefile编译链接,居然出Warning。
但是如果把取模操作注释掉就没事了。
难道是我的makefile里面没有找到c编译器关于取模操作的lib?
makefile:
libTESTC.a : test_c.o
/usr/bin/ld -o libTESTC.a -G -bexpall -bnoentry test_c.o
test_c.o : test_c.c
/usr/vac/bin/xlc -Aa -c -I/usr/include -I/opt/hitachicodecnv/include -I/include test_c.c -o test_c.o
编译错误:
/usr/vac/bin/xlc -Aa -c -I/usr/include -I/opt/hitachicodecnv/include -I/include test_c.c -o test_c.o
/usr/bin/ld -o libTESTC.a -G -bexpall -bnoentry test_c.o
ld: 0711-768 WARNING: Object test_c.o, section 1, function .__divss:
The branch at address 0xa8 is not followed by a recognized no-op
or TOC-reload instruction. The unrecognized instruction is 0x60850000.
/opt/HILNGcbl/bin/ccbl -d -C2 -P3 -T1 -T2 -T6 -Un -X5 -Mw test_cbl.cbl
/usr/vac/bin/xlc -o TESTCBL -bdynamic -brtl -blibpath: -L/usr/lib -lm -lc -lbsd -L/opt/HILNGcbl/lib -lcbl85 -lcb
l85ml -lcbl85cgi -L./ -lTESTC test_cbl.o
------解决方案--------------------不清楚那里的问题,应该不是 "% "的问题,检查前面是不是有别的错误.
------解决方案--------------------编译时加上如下的选项
-qprocimported=__divss