This is an archive of the discontinued LLVM Phabricator instance.

[crt] Enable sparc and mips targets
ClosedPublic

Authored by xbjfk on Apr 7 2023, 3:33 PM.

Details

Summary

This patch enables sparc and mips in compiler-rt CRT, meaning that now every platform supported by compiler-rt builtins (that runs on Linux, i.e. not WebAssembly) will be suported by compiler-rt CRT

Diff Detail

Event Timeline

xbjfk created this revision.Apr 7 2023, 3:33 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2023, 3:33 PM
xbjfk requested review of this revision.Apr 7 2023, 3:33 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2023, 3:33 PM
Herald added subscribers: Restricted Project, pcwang-thead, aheejin. · View Herald Transcript
phosek added inline comments.Apr 7 2023, 3:39 PM
compiler-rt/lib/crt/crtbegin.c
78

Is this needed? We removed this prefix from all other implementations in D147093.

xbjfk updated this revision to Diff 511841.Apr 7 2023, 9:15 PM

Remove USER_LABEL_PREFIX

xbjfk marked an inline comment as done.Apr 7 2023, 9:18 PM
xbjfk added inline comments.
compiler-rt/lib/crt/crtbegin.c
78

Apologies, I have removed it.

phosek accepted this revision.Apr 7 2023, 9:46 PM

LGTM

This revision is now accepted and ready to land.Apr 7 2023, 9:46 PM
xbjfk marked an inline comment as done.Apr 10 2023, 2:04 AM

Hey I forgot to mention, can you merge this since I dont have commit access yet? Thanks.

MaskRay accepted this revision.Apr 11 2023, 5:05 PM
MaskRay added a subscriber: MaskRay.

Have you tested it on mips machines? And how?

compiler-rt/lib/crt/crtbegin.c
76

move __mips__ before for a relatively sorted order.

xbjfk updated this revision to Diff 512645.Apr 11 2023, 8:29 PM

update order in file

xbjfk added a comment.EditedApr 11 2023, 8:41 PM

Have you tested it on mips machines? And how?

I don't have physical MIPS hardware, but I removed the definition of CRT_HAS_INITFINI_ARRAY in CMake (so the assembly version was used) and tested in a QEMU virtual machine. I made sure the __do_init and __do_fini functions were called by putting a puts call in them (cheap, I know)

xbjfk marked an inline comment as done.Apr 11 2023, 8:41 PM

Update: I found a MIPS WiFi router (mipsel) cross compiled a binary for it, and I can confirm it works on real hardware.

Update: I found a MIPS WiFi router (mipsel) cross compiled a binary for it, and I can confirm it works on real hardware.

Thank you! Can you provide your name and email for the commit message author?

xbjfk added a comment.Apr 12 2023, 3:58 PM

Update: I found a MIPS WiFi router (mipsel) cross compiled a binary for it, and I can confirm it works on real hardware.

Thank you! Can you provide your name and email for the commit message author?

Sure: Reagan Bohan <xbjfk.github@gmail.com>

This revision was automatically updated to reflect the committed changes.