Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用binutils-2.42 gcc12.4 glibc2.28(https://pkg.loongnix.cn/loongnix)报错 #31

Open
yunhai2009 opened this issue Sep 2, 2024 · 1 comment

Comments

@yunhai2009
Copy link

loongarch64-linux-gnu-gcc -shared -static-libgcc -Wl,-O1 -Wl,-z,defs -Wl,-dynamic-linker=/lib64/ld.so.1 -B/home/ubuntu/Desktop/loongarch/build/build-libc/csu/ -Wl,--version-script=/home/ubuntu/Desktop/loongarch/build/build-libc/librt.map -Wl,-soname=librt.so.1 -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both -Wl,--enable-new-dtags,-z,nodelete -L/home/ubuntu/Desktop/loongarch/build/build-libc -L/home/ubuntu/Desktop/loongarch/build/build-libc/math -L/home/ubuntu/Desktop/loongarch/build/build-libc/elf -L/home/ubuntu/Desktop/loongarch/build/build-libc/dlfcn -L/home/ubuntu/Desktop/loongarch/build/build-libc/nss -L/home/ubuntu/Desktop/loongarch/build/build-libc/nis -L/home/ubuntu/Desktop/loongarch/build/build-libc/rt -L/home/ubuntu/Desktop/loongarch/build/build-libc/resolv -L/home/ubuntu/Desktop/loongarch/build/build-libc/mathvec -L/home/ubuntu/Desktop/loongarch/build/build-libc/support -L/home/ubuntu/Desktop/loongarch/build/build-libc/crypt -L/home/ubuntu/Desktop/loongarch/build/build-libc/nptl -Wl,-rpath-link=/home/ubuntu/Desktop/loongarch/build/build-libc:/home/ubuntu/Desktop/loongarch/build/build-libc/math:/home/ubuntu/Desktop/loongarch/build/build-libc/elf:/home/ubuntu/Desktop/loongarch/build/build-libc/dlfcn:/home/ubuntu/Desktop/loongarch/build/build-libc/nss:/home/ubuntu/Desktop/loongarch/build/build-libc/nis:/home/ubuntu/Desktop/loongarch/build/build-libc/rt:/home/ubuntu/Desktop/loongarch/build/build-libc/resolv:/home/ubuntu/Desktop/loongarch/build/build-libc/mathvec:/home/ubuntu/Desktop/loongarch/build/build-libc/support:/home/ubuntu/Desktop/loongarch/build/build-libc/crypt:/home/ubuntu/Desktop/loongarch/build/build-libc/nptl -o /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt.so -T /home/ubuntu/Desktop/loongarch/build/build-libc/shlib.lds /home/ubuntu/Desktop/loongarch/build/build-libc/csu/abi-note.o -Wl,--whole-archive /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a -Wl,--no-whole-archive /home/ubuntu/Desktop/loongarch/build/build-libc/nptl/libpthread.so -Wl,--start-group /home/ubuntu/Desktop/loongarch/build/build-libc/libc.so /home/ubuntu/Desktop/loongarch/build/build-libc/libc_nonshared.a -Wl,--as-needed /home/ubuntu/Desktop/loongarch/build/build-libc/elf/ld.so -Wl,--no-as-needed -Wl,--end-group
Dump relocate record:
stack top relocation name symbol
at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x375):
...
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x37b):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x381):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x387):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x38d):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x393):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x399):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x39f):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x3a5):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x3ab):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x3b1):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x3b7):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x3bd):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x3c3):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x3cb):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x3d6):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x3e0):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x3e9):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x3f2):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x3fb):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x403):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x40d):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x416):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x41e):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x429):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.debug_line+0x42d):
0x0000000000000000 R_LARCH_ADD16 L0' 0x0000000000000000 R_LARCH_SUB16 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.eh_frame+0x1c):
0x0000000000000000 R_LARCH_32_PCREL `L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.eh_frame+0x20):
0x0000000000000000 R_LARCH_ADD32 L0' 0x0000000000000000 R_LARCH_SUB32 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.eh_frame+0x26):
0x0000000000000000 R_LARCH_ADD8 L0' 0x0000000000000000 R_LARCH_SUB8 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.eh_frame+0x34):
0x0000000000000000 R_LARCH_32_PCREL `L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.eh_frame+0x38):
0x0000000000000000 R_LARCH_ADD32 L0' 0x0000000000000000 R_LARCH_SUB32 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.eh_frame+0x3e):
0x0000000000000000 R_LARCH_ADD8 L0' 0x0000000000000000 R_LARCH_SUB8 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt_pic.a(librt-cancellation.os)(.eh_frame+0x46):
0x0000000000000000 R_LARCH_ADD6 L0' 0x0000000000000000 R_LARCH_SUB6 L0'

at /home/ubuntu/Desktop/loongarch/build/build-libc/libc_nonshared.a(pthread_atfork.oS)(.text+0x0):
0x0000000000000000 R_LARCH_PCREL20_S2 __dso_handle' 0x0000000000000000 R_LARCH_RELAX '

at /home/ubuntu/Desktop/loongarch/build/build-libc/libc_nonshared.a(pthread_atfork.oS)(.text+0x4):
0x0000000000000000 R_LARCH_NONE <nameless>' 0x0000000000000000 R_LARCH_RELAX '

at /home/ubuntu/Desktop/loongarch/build/build-libc/libc_nonshared.a(pthread_atfork.oS)(.text+0x8):
0x0000000000000000 R_LARCH_B26 __register_atfork@@GLIBC_2.27' 0x0000000000000000 R_LARCH_SOP_PUSH_ABSOLUTE ' + 131072(0x20000)
0x0000000000020000 R_LARCH_SOP_ADD `'

-- Record dump end --

/home/ubuntu/Desktop/loongarch/build/build-libc/libc_nonshared.a(pthread_atfork.oS): in function `__pthread_atfork':
/home/ubuntu/Desktop/loongarch/src/glibc-2.28/nptl/../sysdeps/loongarch/pthread_atfork.c:51:(.text+0x8): Internal stack state is incorrect.
Want to push to full stack or pop from empty stack?
collect2: error: ld returned 1 exit status
make[2]: *** [../Makerules:606:/home/ubuntu/Desktop/loongarch/build/build-libc/rt/librt.so] 错误 1
make[2]: 离开目录“/home/ubuntu/Desktop/loongarch/src/glibc-2.28/rt”
make[1]: *** [Makefile:486:rt/others] 错误 2
make[1]: 离开目录“/home/ubuntu/Desktop/loongarch/src/glibc-2.28”
make: *** [Makefile:9:all] 错误 2

@yunhai2009
Copy link
Author

另外发现一个问题,如果使用binutils-2.42 gcc12.4 glibc2.28生成的交叉编译工具链,生成的elf的标志(flags)为0x43,而龙芯官方公布的工具链编译生成的elf标志为0x3。请问是不是说binutils在新旧世界并不兼容?binutils-2.42只能生成新世界的elf,而龙芯公布的binutils-2.31.1只能生成旧世界的elf。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant