Use THUMB 'ret' when in THUMB mode.

https://github.com/upx/upx/issues/236
https://github.com/upx/upx/issues/229
	modified:   src/arm.v4t-linux.shlib-init.S

	modified:   arm.v5t-linux.shlib-init.h
	modified:   tmp/arm.v5t-linux.shlib-init.bin.dump
This commit is contained in:
John Reiser 2018-12-13 20:10:57 -08:00
parent 473b90419f
commit 75c31dff1d
3 changed files with 36 additions and 33 deletions

View File

@ -32,8 +32,8 @@
#define STUB_ARM_V5T_LINUX_SHLIB_INIT_SIZE 15578
#define STUB_ARM_V5T_LINUX_SHLIB_INIT_ADLER32 0x9621224f
#define STUB_ARM_V5T_LINUX_SHLIB_INIT_CRC32 0x76d0f39b
#define STUB_ARM_V5T_LINUX_SHLIB_INIT_ADLER32 0xca642344
#define STUB_ARM_V5T_LINUX_SHLIB_INIT_CRC32 0x44e5965c
unsigned char stub_arm_v5t_linux_shlib_init[15578] = {
/* 0x0000 */ 127, 69, 76, 70, 1, 1, 1, 97, 0, 0, 0, 0, 0, 0, 0, 0,
@ -42,13 +42,13 @@ unsigned char stub_arm_v5t_linux_shlib_init[15578] = {
/* 0x0030 */ 0, 0, 0, 0,192, 70,255,181, 0,161, 28, 57, 11,104, 1, 32,
/* 0x0040 */ 13, 29, 76,104, 24, 64, 27, 26, 45, 27, 0, 3,140,104, 0, 44,
/* 0x0050 */ 2,208,100, 25, 36, 24, 8,148, 8,105, 64, 25, 89, 25,131,176,
/* 0x0060 */ 0,181, 76,104, 12, 49, 9, 25, 0,240,166,248, 3, 5, 27, 13,
/* 0x0060 */ 0,181, 76,104, 12, 49, 9, 25, 0,240,167,248, 3, 5, 27, 13,
/* 0x0070 */ 228, 24, 16,180,192, 26, 1,180,228, 26,192, 24,155, 8, 8,180,
/* 0x0080 */ 0,240, 63,248, 27, 6,137, 8, 27, 14,137, 0, 80, 43, 17,209,
/* 0x0090 */ 14,224, 4, 57, 66, 88, 19, 1, 27, 15, 11, 43, 8,209,137, 8,
/* 0x00a0 */ 83, 26,137, 0, 18, 14, 27, 2, 18, 6, 27, 10, 26, 67, 66, 80,
/* 0x00b0 */ 0, 41,238,209,112, 71, 0,181, 75,121, 8,180,139,121, 8,180,
/* 0x00c0 */ 16,180, 1,180, 0,240,166,248, 37, 28, 0,240,166,248, 16,180,
/* 0x00c0 */ 16,180, 1,180, 0,240,167,248, 37, 28, 0,240,167,248, 16,180,
/* 0x00d0 */ 255,247,254,255,252, 64, 45,233, 0,112,129,224, 0, 80,224,227,
/* 0x00e0 */ 2, 65,160,227, 24, 0, 0,234, 24, 0,189,232, 7, 0, 64,224,
/* 0x00f0 */ 3, 32, 66,224, 0, 32,132,229, 0, 64,160,225, 3, 0,160,225,
@ -338,29 +338,29 @@ unsigned char stub_arm_v5t_linux_shlib_init[15578] = {
/* 0x12b0 */ 95, 69, 88, 69, 67,124, 80, 82, 79, 84, 95, 87, 82, 73, 84, 69,
/* 0x12c0 */ 32,102, 97,105,108,101,100, 46, 10, 0, 0, 0,115, 70, 1, 59,
/* 0x12d0 */ 8,180, 3,171, 8,180, 1,180, 32,180, 2,180, 3, 35, 11, 64,
/* 0x12e0 */ 3, 53,237, 24,173, 8, 11,155, 90, 25, 4,155, 0,240,178,248,
/* 0x12f0 */ 82, 25, 10,155, 0,240,178,248, 82, 25, 0, 0, 0,240,112,248,
/* 0x12e0 */ 3, 53,237, 24,173, 8, 11,155, 90, 25, 4,155, 0,240,179,248,
/* 0x12f0 */ 82, 25, 10,155, 0,240,179,248, 82, 25, 0, 0, 0,240,113,248,
/* 0x1300 */ 0, 36,228, 67, 50, 35, 3, 34, 13,153, 12,152, 6, 28,192, 39,
/* 0x1310 */ 0,223,176, 66, 0,208, 1,222, 11,157, 15,153, 0,240, 85,248,
/* 0x1320 */ 31,188,160, 71, 8,188, 3,188, 1, 35, 3,180, 64, 24, 1, 48,
/* 0x1330 */ 152, 67, 10, 75, 3, 96, 1, 48, 11,144, 63,188, 27, 66, 0,208,
/* 0x1340 */ 160, 71, 0,152, 1,153, 9, 24, 0,240,106,248, 11,188,158, 70,
/* 0x1340 */ 160, 71, 0,152, 1,153, 9, 24, 0,240,107,248, 11,188,158, 70,
/* 0x1350 */ 5, 34,125, 39, 0,223, 91, 39, 3,189, 0, 0, 0,223,255,189,
/* 0x1360 */ 137, 8,137, 0, 0,181, 11, 28, 0,240,178,248, 8,188,158, 70,
/* 0x1360 */ 137, 8,137, 0, 0,181, 11, 28, 0,240,179,248, 8,188,158, 70,
/* 0x1370 */ 11,104, 4, 49, 3, 96, 4, 48, 1, 61, 7, 35, 29, 66,247,209,
/* 0x1380 */ 237, 8, 13,208,120, 71,192, 70,212, 3, 45,233,220, 19,177,232,
/* 0x1380 */ 237, 8, 15,208,120, 71,192, 70,212, 3, 45,233,220, 19,177,232,
/* 0x1390 */ 1, 80, 85,226,220, 19,160,232, 46, 0, 0, 26,212, 3,189,232,
/* 0x13a0 */ 30,255, 47,225, 0, 34, 15, 39, 63, 4, 2, 55, 0,223,112, 71,
/* 0x13b0 */ 115, 70, 1, 59, 8,180, 0,240,178,248, 82, 25,145, 0, 0, 36,
/* 0x13c0 */ 228, 67, 34, 35, 7, 34, 17,145, 0, 32,192, 39, 0,223, 3, 19,
/* 0x13d0 */ 1, 51, 0,209, 1,222, 16,144, 13,153, 12,157, 0,240, 85,248,
/* 0x13e0 */ 1,153, 2,157, 3, 35, 11, 64,201, 26,237, 24, 27, 24, 1,147,
/* 0x13f0 */ 3, 53,173, 8, 0,240, 85,248, 2, 28, 5,153, 5,144, 0,240,
/* 0x1400 */ 72,248, 67, 28, 11,153, 11,147, 0,240, 72,248, 2,188, 71, 28,
/* 0x1410 */ 0,240, 72,248, 1, 28, 16, 28,190, 70,195,231,204,120,139,120,
/* 0x1420 */ 36, 2, 28, 67, 75,120, 36, 2, 28, 67, 11,120, 36, 2, 28, 67,
/* 0x1430 */ 4, 49,112, 71,155, 8,155, 0, 4, 59, 29,136,109, 5,173, 10,
/* 0x1440 */ 91,136, 91, 5, 91, 13,237, 24, 2, 53,109, 8,112, 71, 0, 0,
/* 0x13a0 */ 30,255, 47,225,112, 71, 0, 34, 15, 39, 63, 4, 2, 55, 0,223,
/* 0x13b0 */ 112, 71,115, 70, 1, 59, 8,180, 0,240,179,248, 82, 25,145, 0,
/* 0x13c0 */ 0, 36,228, 67, 34, 35, 7, 34, 17,145, 0, 32,192, 39, 0,223,
/* 0x13d0 */ 3, 19, 1, 51, 0,209, 1,222, 16,144, 13,153, 12,157, 0,240,
/* 0x13e0 */ 85,248, 1,153, 2,157, 3, 35, 11, 64,201, 26,237, 24, 27, 24,
/* 0x13f0 */ 1,147, 3, 53,173, 8, 0,240, 85,248, 2, 28, 5,153, 5,144,
/* 0x1400 */ 0,240, 72,248, 67, 28, 11,153, 11,147, 0,240, 72,248, 2,188,
/* 0x1410 */ 71, 28, 0,240, 72,248, 1, 28, 16, 28,190, 70,195,231,204,120,
/* 0x1420 */ 139,120, 36, 2, 28, 67, 75,120, 36, 2, 28, 67, 11,120, 36, 2,
/* 0x1430 */ 28, 67, 4, 49,112, 71,155, 8,155, 0, 4, 59, 29,136,109, 5,
/* 0x1440 */ 173, 10, 91,136, 91, 5, 91, 13,237, 24, 2, 53,109, 8,112, 71,
/* 0x1450 */ 102,105,108,101, 32,102,111,114,109, 97,116, 32,101,108,102, 51,
/* 0x1460 */ 50, 45,108,105,116,116,108,101, 97,114,109, 10, 10, 83,101, 99,
/* 0x1470 */ 116,105,111,110,115, 58, 10, 73,100,120, 32, 78, 97,109,101, 32,
@ -991,22 +991,22 @@ unsigned char stub_arm_v5t_linux_shlib_init[15578] = {
/* 0x3b80 */ 102, 69, 76, 70, 77, 65, 73, 78, 90, 10, 48, 48, 48, 48, 48, 48,
/* 0x3b90 */ 99, 99, 32, 82, 95, 65, 82, 77, 95, 80, 67, 50, 52, 32, 32, 32,
/* 0x3ba0 */ 32, 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 90, 10, 48, 48,
/* 0x3bb0 */ 48, 48, 48, 48,101, 97, 32, 82, 95, 65, 82, 77, 95, 84, 72, 77,
/* 0x3bb0 */ 48, 48, 48, 48,101, 99, 32, 82, 95, 65, 82, 77, 95, 84, 72, 77,
/* 0x3bc0 */ 95, 67, 65, 76, 76, 32, 32, 32, 32, 46,114,101, 97,108, 95,115,
/* 0x3bd0 */ 116, 97,114,116, 95,111,102, 69, 76, 70, 77, 65, 73, 78, 90, 10,
/* 0x3be0 */ 48, 48, 48, 48, 48, 49, 49, 48, 32, 82, 95, 65, 82, 77, 95, 84,
/* 0x3be0 */ 48, 48, 48, 48, 48, 49, 49, 50, 32, 82, 95, 65, 82, 77, 95, 84,
/* 0x3bf0 */ 72, 77, 95, 67, 65, 76, 76, 32, 32, 32, 32, 46,114,101, 97,108,
/* 0x3c00 */ 95,115,116, 97,114,116, 95,111,102, 69, 76, 70, 77, 65, 73, 78,
/* 0x3c10 */ 90, 10, 48, 48, 48, 48, 48, 49, 50, 56, 32, 82, 95, 65, 82, 77,
/* 0x3c10 */ 90, 10, 48, 48, 48, 48, 48, 49, 50, 97, 32, 82, 95, 65, 82, 77,
/* 0x3c20 */ 95, 84, 72, 77, 95, 67, 65, 76, 76, 32, 32, 32, 32, 46,114,101,
/* 0x3c30 */ 97,108, 95,115,116, 97,114,116, 95,111,102, 69, 76, 70, 77, 65,
/* 0x3c40 */ 73, 78, 90, 10, 48, 48, 48, 48, 48, 49, 51, 50, 32, 82, 95, 65,
/* 0x3c40 */ 73, 78, 90, 10, 48, 48, 48, 48, 48, 49, 51, 52, 32, 82, 95, 65,
/* 0x3c50 */ 82, 77, 95, 84, 72, 77, 95, 67, 65, 76, 76, 32, 32, 32, 32, 46,
/* 0x3c60 */ 114,101, 97,108, 95,115,116, 97,114,116, 95,111,102, 69, 76, 70,
/* 0x3c70 */ 77, 65, 73, 78, 90, 10, 48, 48, 48, 48, 48, 49, 51, 99, 32, 82,
/* 0x3c70 */ 77, 65, 73, 78, 90, 10, 48, 48, 48, 48, 48, 49, 51,101, 32, 82,
/* 0x3c80 */ 95, 65, 82, 77, 95, 84, 72, 77, 95, 67, 65, 76, 76, 32, 32, 32,
/* 0x3c90 */ 32, 46,114,101, 97,108, 95,115,116, 97,114,116, 95,111,102, 69,
/* 0x3ca0 */ 76, 70, 77, 65, 73, 78, 90, 10, 48, 48, 48, 48, 48, 49, 52, 52,
/* 0x3ca0 */ 76, 70, 77, 65, 73, 78, 90, 10, 48, 48, 48, 48, 48, 49, 52, 54,
/* 0x3cb0 */ 32, 82, 95, 65, 82, 77, 95, 84, 72, 77, 95, 67, 65, 76, 76, 32,
/* 0x3cc0 */ 32, 32, 32, 46,114,101, 97,108, 95,115,116, 97,114,116, 95,111,
/* 0x3cd0 */ 102, 69, 76, 70, 77, 65, 73, 78, 90, 10

View File

@ -402,7 +402,7 @@ movsl_subr:
movsl: // In: edi= 4-byte aligned dst; esi= 4-byte aligned src; ecx= word count
.real_start_ofmovsl:
mov tmp,#7; tst ecx,tmp; bne 9b
lsr ecx,#3; beq 9f
lsr ecx,#3; beq 8f // THUMB return when zero
.balign 4; bx pc; nop // enter ARM mode
.arm
stmdb sp!,{r2, r4,r6, r7,r8,r9} // tmp===r3, ecx===r5
@ -412,6 +412,9 @@ movsl: // In: edi= 4-byte aligned dst; esi= 4-byte aligned src; ecx= word coun
ldmia sp!,{r2, r4,r6, r7,r8,r9}
9:
ret
8:
.thumb
bx lr
#if !defined(ARMEL_EABI4) /*{*/
.arm

View File

@ -258,9 +258,9 @@ OFFSET TYPE VALUE
0000007c R_ARM_THM_CALL .real_start_ofELFMAINZ
0000009c R_ARM_THM_CALL .real_start_ofELFMAINZ
000000cc R_ARM_PC24 ELFMAINZ
000000ea R_ARM_THM_CALL .real_start_ofELFMAINZ
00000110 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000128 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000132 R_ARM_THM_CALL .real_start_ofELFMAINZ
0000013c R_ARM_THM_CALL .real_start_ofELFMAINZ
00000144 R_ARM_THM_CALL .real_start_ofELFMAINZ
000000ec R_ARM_THM_CALL .real_start_ofELFMAINZ
00000112 R_ARM_THM_CALL .real_start_ofELFMAINZ
0000012a R_ARM_THM_CALL .real_start_ofELFMAINZ
00000134 R_ARM_THM_CALL .real_start_ofELFMAINZ
0000013e R_ARM_THM_CALL .real_start_ofELFMAINZ
00000146 R_ARM_THM_CALL .real_start_ofELFMAINZ