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

loongarch: add glibc start.S to make zig-bootstrap work for loongarch64-linux-gnu #21015

Merged
merged 8 commits into from
Aug 14, 2024

Conversation

yxd-ym
Copy link
Contributor

@yxd-ym yxd-ym commented Aug 10, 2024

start.S and regdef.h are from glibc 2.40.

Current LLVM 18 does not support .cfi_label yet in start.S.

We need this in LLVM to make this code work in zig-bootstrap.
llvm/llvm-project#97922

Also, I'm not sure whether I should put the regdef.h file the path here in this patch or should put it at lib/libc/include/loongarch64-linux-gnu/sys

@alexrp
Copy link
Member

alexrp commented Aug 10, 2024

That's odd; I definitely updated the start files in #20993. Hmm...

@alexrp
Copy link
Member

alexrp commented Aug 10, 2024

We need this in LLVM to make this code work in zig-bootstrap.
llvm/llvm-project#97922

This fix is in LLVM 19; we also need it for RISC-V.

@alexrp
Copy link
Member

alexrp commented Aug 10, 2024

Ok, I see what went wrong. The update procedure doesn't document the fact that start files for new architectures need to be added by hand.

However, I believe we might need some more headers:

❯ fd '\.h' lib/libc/glibc/**/riscv
lib/libc/glibc/sysdeps/riscv/bits/endianness.h
lib/libc/glibc/sysdeps/riscv/nptl/bits/pthreadtypes-arch.h
lib/libc/glibc/sysdeps/unix/sysv/linux/riscv/kernel-features.h
lib/libc/glibc/sysdeps/unix/sysv/linux/riscv/sysdep.h

It's not actually clear to me why we're duplicating these between lib/libc/include/... and lib/libc/glibc/..., but let's just do it consistently at least.

Also, I'm not sure whether I should put the regdef.h file the path here in this patch or should put it at lib/libc/include/loongarch64-linux-gnu/sys

I think you placed it correctly, but just to be sure, I'll build glibc for loongarch64-linux-gnu again locally and get back to you on this.

@alexrp
Copy link
Member

alexrp commented Aug 10, 2024

I think you placed it correctly, but just to be sure, I'll build glibc for loongarch64-linux-gnu again locally and get back to you on this.

Yes, it's correct; it doesn't get installed to /usr/include.

So, just need the extra headers I mentioned above and this should be good to go.

src/glibc.zig Show resolved Hide resolved
@andrewrk andrewrk enabled auto-merge (squash) August 14, 2024 17:38
@andrewrk andrewrk merged commit 0f0f543 into ziglang:master Aug 14, 2024
9 of 10 checks passed
SammyJames pushed a commit to SammyJames/zig that referenced this pull request Aug 15, 2024
@yxd-ym yxd-ym deleted the start_s branch August 16, 2024 10:16
richerfu pushed a commit to richerfu/zig that referenced this pull request Oct 28, 2024
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

Successfully merging this pull request may close these issues.

3 participants