1

这是一个类似于警告的问题:在静态链接的应用程序中使用 'getaddrinfo' 需要在运行时使用 glibc 版本中用于链接的共享库

在运行时,getaddrinfo("localhost") 会打开/etc/resolv.conf,这很奇怪!我什至发现 gcc 静态链接的可执行文件将包含硬编码字符串,例如 /etc/resolv.conf,这很糟糕吗?

localhost:tmp macq$ strings node.armv5.static |grep /etc
        // Test: ./node test/fixtures/echo.js < /etc/passwd
/etc/egd-pool
/etc/entropy
/etc/ssl/private
/etc/ssl
/etc/ssl/certs
/etc/ssl/cert.pem
/etc/hosts
/etc/resolv.conf
/etc/nsswitch.conf
/etc/host.conf
/etc/svc.conf
/etc/localtime
/etc/gai.conf
/etc/ld.so.cache
/etc/ld.so.nohwcap
/etc/suid-debug
/etc/mtab

我只想知道这个警告的来源和getaddrinfo的逻辑。

我认为它来自 libgcc,但我完全检查了 gcc 4.4、4.5 的来源,没有找到这样的错误字符串模式,事件没有找到 getaddrinfo 实现。我找不到 ld(colloect2) 的来源。

gcc中getaddrinfo的来源在哪里?libnss_files.so 的来源在哪里?

编辑:谢谢大家。我现在改了标题,谁能告诉我getaddrinfo之类的实现的源代码,它们似乎不在libc中。

4

0 回答 0