This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/50457] SH2A atomic functions


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50457

--- Comment #10 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-10-01 23:39:12 UTC ---
(In reply to comment #9)
> (In reply to comment #8)
> > Would that be OK to do?
> 
> Yes, that sounds good for maintenance.

OK, I've already got something here, but I'm confused about one thing.
In config/sh/linux-atomic.S the function names go like ...

    .global    __sync_lock_test_and_set_##N; \
    HIDDEN_FUNC(__sync_lock_test_and_set_##N); \

(two leading underscores)


When no atomic model is selected the compiler will turn this

int test (int* x, int y, int z)
{
  return __sync_val_compare_and_swap (x, y, z);
}

into:
    .global    _test
    .type    _test, @function
_test:
    mov.l    .L2,r0    ! 11    movsi_ie/1    [length = 2]
    jmp    @r0
    nop    ! 12    sibcall_valuei    [length = 4]
.L3:
    .align 2
.L2:
    .long    ___sync_val_compare_and_swap_4

(three leading underscores)

Looking at config/arm/linux-atomic.c, the C functions all start with two
leading underscores, which will result in three leading underscores in the .asm
file.

How does this fit together in the SH case?  The compiler generates refs to
'___sync*' but in the .S file there are only '__sync' symbols.  I'm afraid I'm
missing something here...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]