[quote]
[color=blue][b]eve@eve:~/squashfs-root$ sudo chroot . ./qemu-arm -E LD_PRELOAD="/nvram.so" usr/sbin/httpd [/b][/color]
usr/sbin/httpd: relocation error: /nvram.so: symbol __register_frame_info, version GLIBC_2.0 not defined in file libgcc_s.so.1 with link time reference
eve@eve:~/squashfs-root$
[/quote]
[quote]
#include <stdio.h>
#include <string.h>
[color=darkblue][b]void __register_frame_info(void) { }
void __deregister_frame_info(void) { }
void __unregister_frame_info(void) { }
[/b][/color]
char *nvram_get(char *key)
{
char *value = NULL;
if(strcmp(key, "lan_ipaddr") == 0)
{
value = strdup("127.0.0.1");
}
if(strcmp(key, "lan_proto") == 0)
{
value = strdup("static");
}
printf("nvram_get(%s) == %s\n", key, value);
return value;
}
[/quote]
[b][color=blue][quote]chroot . ./qemu-arm -E LD_PRELOAD="/nvram.so" usr/sbin/httpd [/quote][/color][/b]
[color=blue][b]eve@eve:~/squashfs-root$ sudo chroot . ./qemu-arm -E LD_PRELOAD="/nvram.so" usr/sbin/httpd [/b][/color]
usr/sbin/httpd: relocation error: /nvram.so: symbol __register_frame_info, version GLIBC_2.0 not defined in file libgcc_s.so.1 with link time reference
eve@eve:~/squashfs-root$
[/quote]
[quote]
#include <stdio.h>
#include <string.h>
[color=darkblue][b]void __register_frame_info(void) { }
void __deregister_frame_info(void) { }
void __unregister_frame_info(void) { }
[/b][/color]
char *nvram_get(char *key)
{
char *value = NULL;
if(strcmp(key, "lan_ipaddr") == 0)
{
value = strdup("127.0.0.1");
}
if(strcmp(key, "lan_proto") == 0)
{
value = strdup("static");
}
printf("nvram_get(%s) == %s\n", key, value);
return value;
}
[/quote]
[b][color=blue][quote]chroot . ./qemu-arm -E LD_PRELOAD="/nvram.so" usr/sbin/httpd [/quote][/color][/b]
本文介绍了一种在ARM环境中使用QEMU运行HTTP服务时遇到的符号未定义错误及解决方案。通过创建自定义的__register_frame_info函数,并在加载nvram.so时预加载该函数,解决了GLIBC_2.0版本不兼容的问题。
2万+

被折叠的 条评论
为什么被折叠?



