Skip to content

Commit

Permalink
Bug97: Changes to build newlib for NanoMIPS with LLVM/Clang
Browse files Browse the repository at this point in the history
LLVM integrated assembler does not support assembler relaxations.
It chooses 16-bit conditional branches and relies on linker relaxation
to transform them in to the correct instruction.  Handwritten assembly
must be compiled with linker relaxation and PC-relative addressing
explicitly enabled to match C compilation.

Change-Id: I751e9d04726d437714723e466e305ff1a8f2cc4a
  • Loading branch information
farazs-github committed Apr 3, 2024
1 parent cdfc026 commit 2a4a94c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions newlib/libc/machine/mips/setjmp.S
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@
#define GPOFF(INDEX) (INDEX * BYTES_PER_WORD)
#define FPOFF(INDEX) ((INDEX + NUM_GPRS_SAVED) * BYTES_PER_WORD)

#ifdef __nanomips__
.linkrelax
.module pcrel
#endif

/* int setjmp (jmp_buf); */
.globl setjmp
.ent setjmp
Expand Down
2 changes: 2 additions & 0 deletions newlib/libc/machine/mips/strcmp.S
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@

#ifdef __nanomips__
# define _FUNCTION_SECTIONS_
.linkrelax
.module pcrel
#endif

#ifdef ANDROID_CHANGES
Expand Down

0 comments on commit 2a4a94c

Please sign in to comment.