从Linux确定AIX的库归档是32位,64位还是两者(Determining whether a library archive for AIX is 32

系统教程 行业动态 更新时间:2024-06-14 16:57:40
从Linux确定AIX的库归档是32位,64位还是两者(Determining whether a library archive for AIX is 32-bit, 64-bit, or both, from Linux)

在AIX上,我会运行:

ar -X32 -t libdb2.a

并检查输出以确定存档中是否存在32位对象。 与-X64类似,用于检查64位对象。 但是,如果我在另一个平台上,并且需要检查存档以查看它具有什么,那该怎么办? 通常我需要检查时我在Linux上,但我可以很容易地在Solaris或HP-UX上。

我曾经检查过shr.o和shr_64.o,因为那是正在编译的内容,但是这些内容开始显示在归档中的实际消息中,因此这些内容的可靠性已经降到了我的位置得到误报。

如果有人有一个指针,最好是我可以用perl做的事情,那就太好了。

On AIX, I would run:

ar -X32 -t libdb2.a

and check for output to determine if there is a 32-bit object in the archive. Similarly with -X64 for checking for a 64-bit object. However, what about if I'm on another platform, and need to check the archive to see what it has? Usually I'm on Linux when I need to check, but I could just as easily be on Solaris or HP-UX.

I used to check for shr.o and shr_64.o, since that's what's being compiled, but those are starting to show up in actual messages that are in the archives, and thus the reliability of these have dropped to the point where I'm getting false positives.

If anyone has a pointer, preferably something I can do in perl, that'd be great.

最满意答案

我不认为有一个简单的方法。 如果创建两个AIX归档,一个32位和一个64位,如下所示:

$ cat a.c int foo (void) { return 42; } $ xlc -q32 a.c -c -o a32.o $ xlc -q64 a.c -c -o a64.o $ ar -X32 cr a32.a a32.o $ ar -X64 cr a64.a a64.o

你最终得到了linux ar不具有可读格式的档案:

$ file a32.a a64.a a32.a: archive (big format) a64.a: archive (big format) $ ar t a32.a ar: a32.a: File format not recognized $ ar t a64.a ar: a64.a: File format not recognized

我尝试使用strings来查看档案中是否有任何明显的内容,但一无所获。 你剩下的选择是构建一个目标为AIX的binutils包(下载binutils,配置选项--target=powerpc-ibm-aix5.3 ,运行make和--target=powerpc-ibm-aix5.3 :你有一个名为powerpc-ibm-aix5.3-ar的工具powerpc-ibm-aix5.3-ar在那个构建树的某个地方)。

I don't think there is an easy way. If you create two AIX archives, one 32-bit and one 64-bit, as follows:

$ cat a.c int foo (void) { return 42; } $ xlc -q32 a.c -c -o a32.o $ xlc -q64 a.c -c -o a64.o $ ar -X32 cr a32.a a32.o $ ar -X64 cr a64.a a64.o

you end up with archives that are not in a readable format by the linux ar:

$ file a32.a a64.a a32.a: archive (big format) a64.a: archive (big format) $ ar t a32.a ar: a32.a: File format not recognized $ ar t a64.a ar: a64.a: File format not recognized

I tried using strings to see if anything obvious was in the archives, but found nothing. Your ony remaining option is to build a binutils package targetting AIX (download binutils, configure with option --target=powerpc-ibm-aix5.3, run make and voilà: you've got a tool called powerpc-ibm-aix5.3-ar somewhere in that build tree).

更多推荐

本文发布于:2023-04-13 12:27:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/96f761879748c3c3b34447bfb741bf50.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:AIX   Linux   archive   library   Determining

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!