diff options
author | Ian Lance Taylor <iant@golang.org> | 2020-04-06 16:43:02 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2020-04-06 16:43:02 -0700 |
commit | 42fd3e04ccbfbc47c1fddb15d384814637df0636 (patch) | |
tree | e2695726e95b7bd125d52b7bdd315cb0028854fa /libgcc/config | |
parent | 00eb71c43c74cc5143b60d470450c3981037ed3c (diff) | |
parent | 52fa80f853c0b0f623ea9e4c7198e324ce44ff30 (diff) | |
download | gcc-42fd3e04ccbfbc47c1fddb15d384814637df0636.zip gcc-42fd3e04ccbfbc47c1fddb15d384814637df0636.tar.gz gcc-42fd3e04ccbfbc47c1fddb15d384814637df0636.tar.bz2 |
Merge from trunk revision 52fa80f853c0b0f623ea9e4c7198e324ce44ff30
Diffstat (limited to 'libgcc/config')
-rw-r--r-- | libgcc/config/arm/lib1funcs.S | 33 | ||||
-rw-r--r-- | libgcc/config/arm/t-arm | 3 | ||||
-rw-r--r-- | libgcc/config/s390/tpf-unwind.h | 132 |
3 files changed, 95 insertions, 73 deletions
diff --git a/libgcc/config/arm/lib1funcs.S b/libgcc/config/arm/lib1funcs.S index e8d2158..a094417 100644 --- a/libgcc/config/arm/lib1funcs.S +++ b/libgcc/config/arm/lib1funcs.S @@ -226,7 +226,6 @@ LSYM(Lend_fde): .endm #define do_push push #define do_pop pop -#define COND(op1, op2, cond) op1 ## op2 ## cond /* Perform an arithmetic operation with a variable shift operand. This requires two instructions and a scratch register on Thumb-2. */ .macro shiftop name, dest, src1, src2, shiftop, shiftreg, tmp @@ -241,12 +240,13 @@ LSYM(Lend_fde): .endm #define do_push stmfd sp!, #define do_pop ldmfd sp!, -#define COND(op1, op2, cond) op1 ## cond ## op2 .macro shiftop name, dest, src1, src2, shiftop, shiftreg, tmp \name \dest, \src1, \src2, \shiftop \shiftreg .endm #endif +#define COND(op1, op2, cond) op1 ## op2 ## cond + #ifdef __ARM_EABI__ .macro ARM_LDIV0 name signed cmp r0, #0 @@ -494,7 +494,8 @@ pc .req r15 /* ------------------------------------------------------------------------ */ /* Bodies of the division and modulo routines. */ -/* ------------------------------------------------------------------------ */ +/* ------------------------------------------------------------------------ */ + .macro ARM_DIV_BODY dividend, divisor, result, curbit #if defined (__ARM_FEATURE_CLZ) && ! defined (__OPTIMIZE_SIZE__) @@ -1136,8 +1137,8 @@ FUNC_START aeabi_uidivmod push {r0, r1, lr} bl LSYM(udivsi3_skip_div0_test) POP {r1, r2, r3} - mul r2, r0 - sub r1, r1, r2 + muls r2, r0 + subs r1, r1, r2 bx r3 # else /* Both the quotient and remainder are calculated simultaneously @@ -1151,7 +1152,7 @@ FUNC_START aeabi_uidivmod ARM_FUNC_START aeabi_uidivmod cmp r1, #0 beq LSYM(Ldiv0) - mov r2, r0 + mov r2, r0 udiv r0, r0, r1 mls r1, r0, r1, r2 RET @@ -1235,29 +1236,29 @@ LSYM(Lover10): beq LSYM(Ldiv0) LSYM(divsi3_skip_div0_test): push { work } - mov work, dividend - eor work, divisor @ Save the sign of the result. + movs work, dividend + eors work, divisor @ Save the sign of the result. mov ip, work - mov curbit, #1 - mov result, #0 + movs curbit, #1 + movs result, #0 cmp divisor, #0 bpl LSYM(Lover10) - neg divisor, divisor @ Loops below use unsigned. + negs divisor, divisor @ Loops below use unsigned. LSYM(Lover10): cmp dividend, #0 bpl LSYM(Lover11) - neg dividend, dividend + negs dividend, dividend LSYM(Lover11): cmp dividend, divisor blo LSYM(Lgot_result) THUMB_DIV_MOD_BODY 0 - mov r0, result + movs r0, result mov work, ip cmp work, #0 bpl LSYM(Lover12) - neg r0, r0 + negs r0, r0 LSYM(Lover12): pop { work } RET @@ -1348,8 +1349,8 @@ FUNC_START aeabi_idivmod push {r0, r1, lr} bl LSYM(divsi3_skip_div0_test) POP {r1, r2, r3} - mul r2, r0 - sub r1, r1, r2 + muls r2, r0 + subs r1, r1, r2 bx r3 # else /* Both the quotient and remainder are calculated simultaneously diff --git a/libgcc/config/arm/t-arm b/libgcc/config/arm/t-arm index f2b927f..364f40e 100644 --- a/libgcc/config/arm/t-arm +++ b/libgcc/config/arm/t-arm @@ -3,11 +3,13 @@ LIB1ASMFUNCS = _thumb1_case_sqi _thumb1_case_uqi _thumb1_case_shi \ _thumb1_case_uhi _thumb1_case_si _speculation_barrier HAVE_CMSE:=$(findstring __ARM_FEATURE_CMSE,$(shell $(gcc_compile_bare) -dM -E - </dev/null)) +HAVE_V81M:=$(findstring armv8.1-m.main,$(gcc_compile_bare)) ifeq ($(shell $(gcc_compile_bare) -E -mcmse - </dev/null >/dev/null 2>/dev/null; echo $?),0) CMSE_OPTS:=-mcmse endif ifdef HAVE_CMSE +ifndef HAVE_V81M libgcc-objects += cmse.o cmse_nonsecure_call.o cmse.o: $(srcdir)/config/arm/cmse.c @@ -15,3 +17,4 @@ cmse.o: $(srcdir)/config/arm/cmse.c cmse_nonsecure_call.o: $(srcdir)/config/arm/cmse_nonsecure_call.S $(gcc_compile) -c $< endif +endif diff --git a/libgcc/config/s390/tpf-unwind.h b/libgcc/config/s390/tpf-unwind.h index 2bd5493..fadc06b 100644 --- a/libgcc/config/s390/tpf-unwind.h +++ b/libgcc/config/s390/tpf-unwind.h @@ -32,20 +32,29 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see Description: This function simply checks to see if the address passed to it is in the CP pat code range. */ -#define MIN_PATRANGE 0x10000 -#define MAX_PATRANGE 0x800000 +#define CP_CNF 0x000000000000c18u /* location of BSS CINFC pointer */ +#define cinfc_fast(TAG) (void *) \ + *((unsigned long *) *(unsigned long *) (CP_CNF) + (TAG)) +#define CINFC_CMRESET 187 +#define CINTFC_CMCENBKST 431 +#define CINTFC_CMCENBKED 432 static inline unsigned int __isPATrange (void *addr) { - if (addr > (void *)MIN_PATRANGE && addr < (void *)MAX_PATRANGE) - return 1; - else - return 0; + return !!(addr > cinfc_fast (CINTFC_CMCENBKST) + && addr < cinfc_fast (CINTFC_CMCENBKED)); +} + +static inline unsigned int +__isSkipResetAddr (void *addr) +{ + return !!(addr == cinfc_fast (CINFC_CMRESET)); } /* TPF return address offset from start of stack frame. */ -#define TPFRA_OFFSET 168 +#define ICST_CRET 168 +#define ICST_SRET 320 /* Exceptions macro defined for TPF so that functions without dwarf frame information can be used with exceptions. */ @@ -63,12 +72,12 @@ s390_fallback_frame_state (struct _Unwind_Context *context, (((unsigned long int) context->cfa) - STACK_POINTER_OFFSET)); /* Are we going through special linkage code? */ - if (__isPATrange (context->ra)) + if (__isPATrange (context->ra) || __isSkipResetAddr (context->ra)) { /* Our return register isn't zero for end of stack, so check backward stackpointer to see if it is zero. */ - if (regs == NULL) + if (regs == 0) return _URC_END_OF_STACK; /* No stack frame. */ @@ -83,11 +92,18 @@ s390_fallback_frame_state (struct _Unwind_Context *context, fs->regs.reg[i].loc.reg = i; } - /* ... except for %r14, which is stored at CFA-112 - and used as return address. */ - fs->regs.reg[14].how = REG_SAVED_OFFSET; - fs->regs.reg[14].loc.offset = TPFRA_OFFSET - STACK_POINTER_OFFSET; - fs->retaddr_column = 14; + /* ... except for %r14, which is stored at CFA+offset where offset + is displacment of ICST_CRET or ICST_SRET from CFA */ + if ( __isPATrange(context->ra) ) { + fs->regs.reg[14].how = REG_SAVED_OFFSET; + fs->regs.reg[14].loc.offset = ICST_CRET - STACK_POINTER_OFFSET; + fs->retaddr_column = 14; + } else { + fs->regs.reg[14].how = REG_SAVED_OFFSET; + fs->regs.reg[14].loc.offset = ICST_SRET - STACK_POINTER_OFFSET; + fs->retaddr_column = 14; + + } return _URC_NO_REASON; } @@ -140,6 +156,9 @@ s390_fallback_frame_state (struct _Unwind_Context *context, #define TPFAREA_SIZE STACK_POINTER_OFFSET-TPFAREA_OFFSET #define INVALID_RETURN 0 +#define LOWCORE_PAGE3_ADDR 4032 +#define PG3_SKIPPING_OFFSET 18 + void * __tpf_eh_return (void *target, void *origRA); void * @@ -148,30 +167,29 @@ __tpf_eh_return (void *target, void *origRA) Dl_info targetcodeInfo, currentcodeInfo; int retval; void *current, *stackptr, *destination_frame; + unsigned char *skipFlagAddress; unsigned long int shifter; - bool is_a_stub, frameDepth2, firstIteration; + bool is_a_stub; is_a_stub = false; - frameDepth2 = false; - firstIteration = true; /* Get code info for target return's address. */ retval = dladdr (target, &targetcodeInfo); - /* Check if original RA is a Pat stub. If so set flag. */ - if (__isPATrange (origRA)) - frameDepth2 = true; - /* Ensure the code info is valid (for target). */ if (retval != INVALID_RETURN) { - /* Get the stack pointer of the first stack frame beyond the - unwinder or if exists the calling C++ runtime function (e.g., - __cxa_throw). */ - if (!frameDepth2) - stackptr = (void *) *((unsigned long int *) (*(PREVIOUS_STACK_PTR()))); - else - stackptr = (void *) *(PREVIOUS_STACK_PTR()); + /* Begin climbing stack searching for target address. */ + stackptr = (void *) *(CURRENT_STACK_PTR()); + + /* Get return address based on our stackptr. */ + current = (void *) *(unsigned long *) (stackptr + RA_OFFSET); + + /* Is current return address our initiating exception stack + frame? If not, climb the stack one more frame. */ + if (current != origRA) { + stackptr = (void *) *(unsigned long *) stackptr; + } /* Begin looping through stack frames. Stop if invalid code information is retrieved or if a match between the @@ -179,27 +197,19 @@ __tpf_eh_return (void *target, void *origRA) matches that of the target, calculated above. */ do { - if (!frameDepth2 || (frameDepth2 && !firstIteration)) - { - /* Get return address based on our stackptr iterator. */ - current = (void *) *((unsigned long int *) - (stackptr + RA_OFFSET)); - - /* Is it a Pat Stub? */ - if (__isPATrange (current)) - { - /* Yes it was, get real return address in TPF stack area. */ - current = (void *) *((unsigned long int *) - (stackptr + TPFRA_OFFSET)) - is_a_stub = true; - } - } - else - { - current = (void *) *((unsigned long int *) - (stackptr + TPFRA_OFFSET)); - is_a_stub = true; - } + /* Get return address based on our stackptr iterator. */ + current = (void *) *(unsigned long *) (stackptr + RA_OFFSET); + + /* Is it a Pat Stub? */ + if (__isPATrange (current) + || (__isSkipResetAddr (current) + && __isPATrange ((void *) *(unsigned long *) (stackptr + + ICST_SRET)))) + { + /* Yes it was, get real return address in TPF stack area. */ + current = (void *) *(unsigned long *) (stackptr + ICST_CRET); + is_a_stub = true; + } /* Get codeinfo on RA so that we can figure out the module address. */ @@ -227,8 +237,8 @@ __tpf_eh_return (void *target, void *origRA) /* Now overlay the real target address into the TPF stack area of the target frame we are jumping to. */ - *((unsigned long int *) (destination_frame + - TPFRA_OFFSET)) = (unsigned long int) target; + *(unsigned long *) (destination_frame + ICST_CRET) = + (unsigned long) target; /* Before returning the desired pat stub address to the exception handling unwinder so that it can @@ -237,10 +247,7 @@ __tpf_eh_return (void *target, void *origRA) This is necessary for CTOA stubs. Otherwise we leap one byte past where we want to go to in the TPF pat stub linkage code. */ - if (!frameDepth2 || (frameDepth2 && !firstIteration)) - shifter = *((unsigned long int *) (stackptr + RA_OFFSET)); - else - shifter = (unsigned long int) origRA; + shifter = *(unsigned long *) (stackptr + RA_OFFSET); shifter &= ~1ul; @@ -252,6 +259,13 @@ __tpf_eh_return (void *target, void *origRA) in linkage. */ shifter = shifter - 4; + /* Reset the Function Trace Skipping Switch to re-enable */ + /* recording Trace entries if it was turned off. */ + skipFlagAddress = + (unsigned char *) *(unsigned long *) LOWCORE_PAGE3_ADDR; + skipFlagAddress += PG3_SKIPPING_OFFSET; + *skipFlagAddress = '\x00'; + return (void *) shifter; } @@ -260,14 +274,18 @@ __tpf_eh_return (void *target, void *origRA) stackptr = (void *) *(unsigned long int *) stackptr; is_a_stub = false; - firstIteration = false; } while (stackptr && retval != INVALID_RETURN && targetcodeInfo.dli_fbase != currentcodeInfo.dli_fbase); } + /* Reset the Function Trace Skipping Switch to re-enable */ + /* recording Trace entries if it was turned off. */ + skipFlagAddress = (unsigned char *) *(unsigned long *) LOWCORE_PAGE3_ADDR; + skipFlagAddress += PG3_SKIPPING_OFFSET; + *skipFlagAddress = '\x00'; + /* No pat stub found, could be a problem? Simply return unmodified target address. */ return target; } - |