Why doesn't gcc always emit sync builtins for MIPS?

2021-02-03 Thread Dani T via Gcc
Using crosstool-ng, I built a GCC 10.2 cross toolchain for
mips-unknown-linux-uclibc. It works flawlessly for the legacy app I am
compiling. I recently tried to compile the same application for an embedded
device running an RTOS using a similar GCC cross toolchain built using
crosstool-ng. The main differences are that I configured it to use newlib
instead of uclibc and set it up for bare metal instead of linux. The
toolchain mostly works but I get the following errors when linking:

undefined reference to `__sync_val_compare_and_swap_4'
undefined reference to `__sync_add_and_fetch_4'

A quick look at libgcc.a shows that these symbols exist in the
mips-unknown-linux-uclibc toolchain

dani@ws:~/x-tools$ nm
mips-unknown-linux-uclibc/lib/gcc/mips-unknown-linux-uclibc/10.2.0/libgcc.a
| grep sync_add
sync_add_and_fetch_1.o: T __sync_add_and_fetch_1
sync_add_and_fetch_2.o: T __sync_add_and_fetch_2
sync_add_and_fetch_4.o: T __sync_add_and_fetch_4
sync_add_and_fetch_8.o:
sync_add_and_fetch_16.o:

And not in the mips-unknown-elf toolchain

dani@ws:~/x-tools$ nm
mips-unknown-elf/lib/gcc/mips-unknown-elf/10.2.0/libgcc.a | grep
sync_add
sync_add_and_fetch_1.o:
sync_add_and_fetch_2.o:
sync_add_and_fetch_4.o:
sync_add_and_fetch_8.o:
sync_add_and_fetch_16.o:
dani@ws:~/x-tools$

Why does the GCC compiler not emit the sync builtins when linux is not the
target? How do I configure it so that it does? My current hack is to create
my own assembly implementations that are identical to the ones that GCC
emits in the mips-unknown-linux-uclibc toolchain but would rather
understand why they are not emitted in the first place.


Thanks,


Dan


Re: Reporting a typo in gfortran intrinsic procedure webpage

2021-02-03 Thread Jeff Law via Gcc


On 1/24/21 6:04 PM, zheng via Gcc wrote:
> I'd like to report a typo on page  
> https://gcc.gnu.org/onlinedocs/gfortran/ANINT.html#ANINT .  In the last table 
> on this webpage, AINT should be ANINT.
Thanks.  This is what I pushed to the trunk to fix the typo:


Jeff
commit 34215a7a3a359d700a520f1d5bdaec835f0b5180
Author: Jeff Law 
Date:   Wed Feb 3 15:01:19 2021 -0700

Fix typo in Fortran manual

gcc/fortran:
* intrinsic.texi (ANINT): Fix typo.

diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi
index 5debe94773b..63416bce7fd 100644
--- a/gcc/fortran/intrinsic.texi
+++ b/gcc/fortran/intrinsic.texi
@@ -1232,7 +1232,7 @@ end program test_anint
 @item @emph{Specific names}:
 @multitable @columnfractions .20 .20 .20 .25
 @item Name@tab Argument @tab Return type  @tab Standard
-@item @code{AINT(A)}  @tab @code{REAL(4) A} @tab @code{REAL(4)}   @tab Fortran 
77 and later
+@item @code{ANINT(A)}  @tab @code{REAL(4) A} @tab @code{REAL(4)}   @tab 
Fortran 77 and later
 @item @code{DNINT(A)} @tab @code{REAL(8) A} @tab @code{REAL(8)}   @tab Fortran 
77 and later
 @end multitable
 @end table