[Bug 233361] mips build with BSD_CRTBEGIN, Clang, LLD fails

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Sep 11 14:00:50 UTC 2019


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233361

--- Comment #5 from Kyle Evans <kevans at freebsd.org> ---
I use the following patch in my local mips-llvm branch:

commit 9783fdf63c8a4e1775a494b47b7f3648b65779ab
Author: Kyle Evans <kevans at FreeBSD.org>
Date:   Mon Aug 19 13:18:47 2019 -0500

    Hack around .cprestore anger

diff --git a/lib/csu/mips/crt.h b/lib/csu/mips/crt.h
index 1d967b73ffe..a90d8661f34 100644
--- a/lib/csu/mips/crt.h
+++ b/lib/csu/mips/crt.h
@@ -29,12 +29,14 @@
 #define        HAVE_CTORS
 #define        CTORS_CONSTRUCTORS
 #ifdef __mips_o32
+/* The .cprestore is bogus, as we do elsewhere */
 #define        INIT_CALL_SEQ(func)                                            
\
     ".set noreorder            \n"                                     \
     "bal       1f              \n"                                     \
     "nop                       \n"                                     \
     "1:                                \n"                                    
\
     ".cpload $ra               \n"                                     \
+    ".cprestore 12             \n"                                     \
     ".set reorder              \n"                                     \
     ".local    " __STRING(func) "\n"                                   \
     "jal       " __STRING(func)

I fake the .cprestore based on what we do for _mcount in
^/sys/mips/include/profile.h. Whether this is wrong or not, I do not know, but
it results in a functional world along with the rest of my mips-llvm patches
(https://github.com/freebsd/freebsd/compare/master...kevans91:mips-llvm?expand=1),
some of which were stolen from jhb. This branch results in a functional
CLANG_BOOTSTRAP+LLD_BOOTSTRAP world and kernel for mips32, but mips64 kernel is
horribly broken in weird ways with both llvm8 and projects/clang900-import and
CLANG_BOOTSTRAP+LD_BOOTSTRAP.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list