libsanitizer: Cherry-pick 2bfb0fcb51510f22723c8cdfefe from upstream

Message ID VI1PR03MB48936B498E6BB9FD37E020F082959@VI1PR03MB4893.eurprd03.prod.outlook.com
State New, archived
Headers
Series libsanitizer: Cherry-pick 2bfb0fcb51510f22723c8cdfefe from upstream |

Commit Message

Dimitrije Milošević July 25, 2022, 6:55 a.m. UTC
  2bfb0fcb51510f22723c8cdfefe [Sanitizer][MIPS] Fix stat struct size for the O32 ABI.

Signed-off-by: Dimitrije Milosevic <dimitrije.milosevic@syrmia.com>.

---
 .../sanitizer_common/sanitizer_platform_limits_posix.h     | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
  

Comments

Li, Pan2 via Gcc-patches July 25, 2022, 7:04 a.m. UTC | #1
LGTM.  Requiring permission to push.

> +const unsigned struct_kernel_stat_sz =
> +    SANITIZER_ANDROID
> +        ? FIRST_32_SECOND_64(104, 128)
> +        : FIRST_32_SECOND_64((_MIPS_SIM == _ABIN32) ? 160 : 144, 216);

These values matches sizeof(struct stat) on gcc230, so should be
correct:

xry111@gcc230:~$ cat t.c
#include <stdio.h>
#include <sys/stat.h>

int main()
{
  printf("%d\n", sizeof(struct stat));
}
xry111@gcc230:~$ cc t.c -mabi=32 && ./a.out 
144
xry111@gcc230:~$ cc t.c -mabi=n32 && ./a.out 
160
xry111@gcc230:~$ cc t.c -mabi=64 && ./a.out 
216
  
Dimitrije Milošević July 28, 2022, 1:43 p.m. UTC | #2
Gentle ping, requiring someone to push the change. :)

From: Dimitrije Milosevic
Sent: Monday, July 25, 2022 8:55 AM
To: gcc-patches@gcc.gnu.org <gcc-patches@gcc.gnu.org>
Cc: Djordje Todorovic <Djordje.Todorovic@syrmia.com>; xry111@xry111.site <xry111@xry111.site>
Subject: [PATCH] libsanitizer: Cherry-pick 2bfb0fcb51510f22723c8cdfefe from upstream 
 
2bfb0fcb51510f22723c8cdfefe [Sanitizer][MIPS] Fix stat struct size for the O32 ABI.

Signed-off-by: Dimitrije Milosevic <dimitrije.milosevic@syrmia.com>.

---
 .../sanitizer_common/sanitizer_platform_limits_posix.h     | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
index 89772a7e5c0..75c6cc7f285 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -81,9 +81,10 @@ const unsigned struct_kernel_stat64_sz = 104;
 const unsigned struct_kernel_stat_sz = 144;
 const unsigned struct_kernel_stat64_sz = 104;
 #elif defined(__mips__)
-const unsigned struct_kernel_stat_sz = SANITIZER_ANDROID
-                                           ? FIRST_32_SECOND_64(104, 128)
-                                           : FIRST_32_SECOND_64(144, 216);
+const unsigned struct_kernel_stat_sz =
+    SANITIZER_ANDROID
+        ? FIRST_32_SECOND_64(104, 128)
+        : FIRST_32_SECOND_64((_MIPS_SIM == _ABIN32) ? 160 : 144, 216);
 const unsigned struct_kernel_stat64_sz = 104;
 #elif defined(__s390__) && !defined(__s390x__)
 const unsigned struct_kernel_stat_sz = 64;
  
Martin Liška July 28, 2022, 1:48 p.m. UTC | #3
On 7/28/22 15:43, Dimitrije Milosevic wrote:
> |Gentle ping, requiring someone to push the change. :)|

Sure, I can do that, but please attach output of (git format-patch) as an attachment
to an email. The current email has a weird format I can directly apply with git am.

Cheers,
Martin
  
Dimitrije Milošević July 29, 2022, 6:38 a.m. UTC | #4
Thanks Martin! I'm sending out the output from git format-patch as an attachment to this email.


From: Martin Liška <mliska@suse.cz>
Sent: Thursday, July 28, 2022 3:48 PM
To: Dimitrije Milosevic <Dimitrije.Milosevic@Syrmia.com>; gcc-patches@gcc.gnu.org <gcc-patches@gcc.gnu.org>
Cc: macro@embecosm.com <macro@embecosm.com>; Djordje Todorovic <Djordje.Todorovic@syrmia.com>; joseph@codesourcery.com <joseph@codesourcery.com>
Subject: Re: [PATCH] libsanitizer: Cherry-pick 2bfb0fcb51510f22723c8cdfefe from upstream 
 
On 7/28/22 15:43, Dimitrije Milosevic wrote:
> |Gentle ping, requiring someone to push the change. :)|

Sure, I can do that, but please attach output of (git format-patch) as an attachment
to an email. The current email has a weird format I can directly apply with git am.

Cheers,
Martin
  
Martin Liška Aug. 1, 2022, 4:11 a.m. UTC | #5
On 7/29/22 08:38, Dimitrije Milosevic wrote:
> Thanks Martin! I'm sending out the output from git format-patch as an attachment to this email.

You're welcome, pushed as r13-1909-g1efeaf99bd8bdf.

Cheers,
Martin
  

Patch

diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
index 89772a7e5c0..75c6cc7f285 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -81,9 +81,10 @@  const unsigned struct_kernel_stat64_sz = 104;
 const unsigned struct_kernel_stat_sz = 144;
 const unsigned struct_kernel_stat64_sz = 104;
 #elif defined(__mips__)
-const unsigned struct_kernel_stat_sz = SANITIZER_ANDROID
-                                           ? FIRST_32_SECOND_64(104, 128)
-                                           : FIRST_32_SECOND_64(144, 216);
+const unsigned struct_kernel_stat_sz =
+    SANITIZER_ANDROID
+        ? FIRST_32_SECOND_64(104, 128)
+        : FIRST_32_SECOND_64((_MIPS_SIM == _ABIN32) ? 160 : 144, 216);
 const unsigned struct_kernel_stat64_sz = 104;
 #elif defined(__s390__) && !defined(__s390x__)
 const unsigned struct_kernel_stat_sz = 64;