0

I have been making programs for ages that are under 800K on Linux Fedora 19 using GCC 4.8.1. The readelf utility has reported them as OS/ABI = "UNIX - System V" (byte 8 is zero).

Now suddenly the binaries are turning out over 1MB and readelf is saying they are "UNIX - GNU" (byte 8 is 3). Not my doing! Something is having an influence and I'm not sure what.

For instance, now, using nm, I find that the functions __nss_hosts_lookup2 and openat are being linked in, which weren't there before.

How do I make an executable again that readelf would say is UNIX - System V ?

4

1 回答 1

2

我找到了!全靠我自己。链接器在我提供的库目录中选择了 2007 年 10 月版本的 libc.a libm.a 和 libstdc++.a(提供 780K 可执行文件)。删除这些文件后,它开始选择 2013 年 3 月的版本,因此使可执行文件 (1.1M) 膨胀。不幸的是,我不得不让它变得臃肿,因为我不想找到所有必要的头文件(当然头文件应该与库匹配)。我不责怪软件编写者没有为每个源/目标文件放置一个函数。我责怪链接器仍然没有按函数粒度拖动函数并将循环库搜索作为标准。

于 2015-04-18T03:41:09.130 回答