public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch] More LLP64 fixes and __PIC__ values fixes for PE targets
@ 2023-02-14 10:42 Jonathan Yong
  2023-02-26  5:12 ` NightStrike
  2023-03-11 17:29 ` Jeff Law
  0 siblings, 2 replies; 6+ messages in thread
From: Jonathan Yong @ 2023-02-14 10:42 UTC (permalink / raw)
  To: Gcc Patch List

[-- Attachment #1: Type: text/plain, Size: 20 bytes --]

Attached patches OK?

[-- Attachment #2: 0002-gcc-testsuite-gcc.dg-fix-pic-test-case-for-PE-target.patch --]
[-- Type: text/x-patch, Size: 2100 bytes --]

From 616e43ac41879040e73a266065874148553cddcc Mon Sep 17 00:00:00 2001
From: Jonathan Yong <10walls@gmail.com>
Date: Tue, 14 Feb 2023 10:37:03 +0000
Subject: [PATCH 2/2] gcc/testsuite/gcc.dg: fix pic test case for PE targets

gcc/testsuite/ChangeLog:

	* pic-2.c: fix expected __PIC__ value.
	* pic-3.c: ditto.
	* pic-4.c: ditto.

Signed-off-by: Jonathan Yong <10walls@gmail.com>
---
 gcc/testsuite/gcc.dg/pic-2.c | 6 +++++-
 gcc/testsuite/gcc.dg/pic-3.c | 6 +++++-
 gcc/testsuite/gcc.dg/pic-4.c | 6 +++++-
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/pic-2.c b/gcc/testsuite/gcc.dg/pic-2.c
index 3846ec4ff47..24260538cc0 100644
--- a/gcc/testsuite/gcc.dg/pic-2.c
+++ b/gcc/testsuite/gcc.dg/pic-2.c
@@ -4,7 +4,11 @@
 /* { dg-skip-if "__PIC__ is always 1 for MIPS" { mips*-*-* } } */
 /* { dg-skip-if "__PIE__ is always defined for GCN" { amdgcn*-*-* } } */
 
-#if __PIC__ != 2
+#if defined(__CYGWIN__) || defined(__WIN32__)
+# if __PIC__ != 1
+#  error __PIC__ is not 1!
+# endif
+#elif __PIC__ != 2
 # error __PIC__ is not 2!
 #endif
 
diff --git a/gcc/testsuite/gcc.dg/pic-3.c b/gcc/testsuite/gcc.dg/pic-3.c
index 1397977e7f8..d3eb120652a 100644
--- a/gcc/testsuite/gcc.dg/pic-3.c
+++ b/gcc/testsuite/gcc.dg/pic-3.c
@@ -1,7 +1,11 @@
 /* { dg-do compile { target { ! { *-*-darwin* hppa*64*-*-* mips*-*-linux-* amdgcn*-*-* } } } } */
 /* { dg-options "-fno-pic" } */
 
-#ifdef __PIC__
+#if defined(__CYGWIN__) || defined(__WIN32__)
+# if __PIC__ != 1
+#  error __PIC__ is not 1!
+# endif
+#elif __PIC__
 # error __PIC__ is defined!
 #endif
 
diff --git a/gcc/testsuite/gcc.dg/pic-4.c b/gcc/testsuite/gcc.dg/pic-4.c
index d6d9dc90046..d7acefaf9aa 100644
--- a/gcc/testsuite/gcc.dg/pic-4.c
+++ b/gcc/testsuite/gcc.dg/pic-4.c
@@ -1,7 +1,11 @@
 /* { dg-do compile { target { ! { *-*-darwin* hppa*64*-*-* mips*-*-linux-* amdgcn*-*-* } } } } */
 /* { dg-options "-fno-PIC" } */
 
-#ifdef __PIC__
+#if defined(__CYGWIN__) || defined(__WIN32__)
+# if __PIC__ != 1
+#  error __PIC__ is not 1!
+# endif
+#elif __PIC__
 # error __PIC__ is defined!
 #endif
 
-- 
2.39.1


[-- Attachment #3: 0001-gcc-testsuite-gcc.dg-fix-LLP64-targets.patch --]
[-- Type: text/x-patch, Size: 2068 bytes --]

From a1fafc5a3c70684e843f5f0b6cf392ce349cb6b0 Mon Sep 17 00:00:00 2001
From: Jonathan Yong <10walls@gmail.com>
Date: Tue, 14 Feb 2023 10:29:05 +0000
Subject: [PATCH 1/2] gcc/testsuite/gcc.dg: fix LLP64 targets

gcc/testsuite/ChangeLog:

	* gcc.dg/builtins-69.c: Use (long )*regex pattern to
	allow long long instead of just long.
	* gcc.dg/pr80163.c: use __INTPTR_TYPE__ for LLP64 tagets.

Signed-off-by: Jonathan Yong <10walls@gmail.com>
---
 gcc/testsuite/gcc.dg/builtins-69.c | 2 +-
 gcc/testsuite/gcc.dg/pr80163.c     | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/builtins-69.c b/gcc/testsuite/gcc.dg/builtins-69.c
index 26dfb3bfc1b..b754b5d26ee 100644
--- a/gcc/testsuite/gcc.dg/builtins-69.c
+++ b/gcc/testsuite/gcc.dg/builtins-69.c
@@ -14,7 +14,7 @@ int test_index (void)
 /* PR middle-end/86202 - ICE in get_range_info calling an invalid memcpy()
    declaration */
 
-void *memcpy (void *, void *, __SIZE_TYPE__ *);   /* { dg-warning "conflicting types for built-in function .memcpy.; expected .void \\\*\\\(void \\\*, const void \\\*, \(long \)?unsigned int\\\)." } */
+void *memcpy (void *, void *, __SIZE_TYPE__ *);   /* { dg-warning "conflicting types for built-in function .memcpy.; expected .void \\\*\\\(void \\\*, const void \\\*, \(long \)*unsigned int\\\)." } */
 
 void test_memcpy (void *p, void *q, __SIZE_TYPE__ *r)
 {
diff --git a/gcc/testsuite/gcc.dg/pr80163.c b/gcc/testsuite/gcc.dg/pr80163.c
index 37a7abd1181..f65955c0ec9 100644
--- a/gcc/testsuite/gcc.dg/pr80163.c
+++ b/gcc/testsuite/gcc.dg/pr80163.c
@@ -2,6 +2,7 @@
 /* { dg-do compile { target int128 } } */
 /* { dg-options "-O0" } */
 
+typedef __INTPTR_TYPE__ intptr_t;
 void bar (void);
 
 __int128_t *
@@ -10,7 +11,7 @@ foo (void)
 a:
   bar ();
 b:;
-  static __int128_t d = (long) &&a - (long) &&b;	/* { dg-error "initializer element is not computable at load time" } */
+  static __int128_t d = (intptr_t) &&a - (intptr_t) &&b;	/* { dg-error "initializer element is not computable at load time" } */
   return &d;
 }
 
-- 
2.39.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Patch] More LLP64 fixes and __PIC__ values fixes for PE targets
  2023-02-14 10:42 [Patch] More LLP64 fixes and __PIC__ values fixes for PE targets Jonathan Yong
@ 2023-02-26  5:12 ` NightStrike
  2023-03-11 17:29 ` Jeff Law
  1 sibling, 0 replies; 6+ messages in thread
From: NightStrike @ 2023-02-26  5:12 UTC (permalink / raw)
  To: Jonathan Yong; +Cc: Gcc Patch List

[-- Attachment #1: Type: text/plain, Size: 123 bytes --]

On Tue, Feb 14, 2023, 05:42 Jonathan Yong via Gcc-patches <
gcc-patches@gcc.gnu.org> wrote:

> Attached patches OK?


Ping

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Patch] More LLP64 fixes and __PIC__ values fixes for PE targets
  2023-02-14 10:42 [Patch] More LLP64 fixes and __PIC__ values fixes for PE targets Jonathan Yong
  2023-02-26  5:12 ` NightStrike
@ 2023-03-11 17:29 ` Jeff Law
  2023-03-12  1:54   ` Jonathan Yong
  1 sibling, 1 reply; 6+ messages in thread
From: Jeff Law @ 2023-03-11 17:29 UTC (permalink / raw)
  To: Jonathan Yong, Gcc Patch List



On 2/14/23 03:42, Jonathan Yong via Gcc-patches wrote:
> Attached patches OK?
> 
> 0002-gcc-testsuite-gcc.dg-fix-pic-test-case-for-PE-target.patch
> 
>  From 616e43ac41879040e73a266065874148553cddcc Mon Sep 17 00:00:00 2001
> From: Jonathan Yong<10walls@gmail.com>
> Date: Tue, 14 Feb 2023 10:37:03 +0000
> Subject: [PATCH 2/2] gcc/testsuite/gcc.dg: fix pic test case for PE targets
> 
> gcc/testsuite/ChangeLog:
> 
> 	* pic-2.c: fix expected __PIC__ value.
> 	* pic-3.c: ditto.
> 	* pic-4.c: ditto.
Please adjust your ChangeLog entries slightly, in particular, please 
capitalize the first letter in each ChangeLog entry.  ie, fix->Fix, 
ditto->Ditto.

Presumably the windows platforms are not always PIC and thus should not 
be handled in a manner similar to MIPS?

Assuming that's the case, then this patch is OK with the trivial 
ChangeLog fixes.


> 
> 
> 0001-gcc-testsuite-gcc.dg-fix-LLP64-targets.patch
> 
>  From a1fafc5a3c70684e843f5f0b6cf392ce349cb6b0 Mon Sep 17 00:00:00 2001
> From: Jonathan Yong<10walls@gmail.com>
> Date: Tue, 14 Feb 2023 10:29:05 +0000
> Subject: [PATCH 1/2] gcc/testsuite/gcc.dg: fix LLP64 targets
> 
> gcc/testsuite/ChangeLog:
> 
> 	* gcc.dg/builtins-69.c: Use (long )*regex pattern to
> 	allow long long instead of just long.
> 	* gcc.dg/pr80163.c: use __INTPTR_TYPE__ for LLP64 tagets.
OK with the trivial ChangeLog fix use->Use for the change to pr80163.c.

jeff

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Patch] More LLP64 fixes and __PIC__ values fixes for PE targets
  2023-03-11 17:29 ` Jeff Law
@ 2023-03-12  1:54   ` Jonathan Yong
  2023-03-12 16:54     ` Jeff Law
  0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Yong @ 2023-03-12  1:54 UTC (permalink / raw)
  To: Jeff Law, Gcc Patch List, NightStrike

On 3/11/23 17:29, Jeff Law wrote:
> 
> 
> On 2/14/23 03:42, Jonathan Yong via Gcc-patches wrote:
>> Attached patches OK?
>>
>> 0002-gcc-testsuite-gcc.dg-fix-pic-test-case-for-PE-target.patch
>>
>>  From 616e43ac41879040e73a266065874148553cddcc Mon Sep 17 00:00:00 2001
>> From: Jonathan Yong<10walls@gmail.com>
>> Date: Tue, 14 Feb 2023 10:37:03 +0000
>> Subject: [PATCH 2/2] gcc/testsuite/gcc.dg: fix pic test case for PE 
>> targets
>>
>> gcc/testsuite/ChangeLog:
>>
>>     * pic-2.c: fix expected __PIC__ value.
>>     * pic-3.c: ditto.
>>     * pic-4.c: ditto.
> Please adjust your ChangeLog entries slightly, in particular, please 
> capitalize the first letter in each ChangeLog entry.  ie, fix->Fix, 
> ditto->Ditto.
> 
> Presumably the windows platforms are not always PIC and thus should not 
> be handled in a manner similar to MIPS?
> 
> Assuming that's the case, then this patch is OK with the trivial 
> ChangeLog fixes.
> 
> 

Windows code is effectively always PIC, since the PE loader can relocate 
it anywhere if the preferred address is already occupied. Patch still OK?

>>
>>
>> 0001-gcc-testsuite-gcc.dg-fix-LLP64-targets.patch
>>
>>  From a1fafc5a3c70684e843f5f0b6cf392ce349cb6b0 Mon Sep 17 00:00:00 2001
>> From: Jonathan Yong<10walls@gmail.com>
>> Date: Tue, 14 Feb 2023 10:29:05 +0000
>> Subject: [PATCH 1/2] gcc/testsuite/gcc.dg: fix LLP64 targets
>>
>> gcc/testsuite/ChangeLog:
>>
>>     * gcc.dg/builtins-69.c: Use (long )*regex pattern to
>>     allow long long instead of just long.
>>     * gcc.dg/pr80163.c: use __INTPTR_TYPE__ for LLP64 tagets.
> OK with the trivial ChangeLog fix use->Use for the change to pr80163.c.
> 
> jeff

OK.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Patch] More LLP64 fixes and __PIC__ values fixes for PE targets
  2023-03-12  1:54   ` Jonathan Yong
@ 2023-03-12 16:54     ` Jeff Law
  2023-03-15  0:12       ` Jonathan Yong
  0 siblings, 1 reply; 6+ messages in thread
From: Jeff Law @ 2023-03-12 16:54 UTC (permalink / raw)
  To: Jonathan Yong, Gcc Patch List, NightStrike



On 3/11/23 18:54, Jonathan Yong wrote:
> On 3/11/23 17:29, Jeff Law wrote:
>>
>>
>> On 2/14/23 03:42, Jonathan Yong via Gcc-patches wrote:
>>> Attached patches OK?
>>>
>>> 0002-gcc-testsuite-gcc.dg-fix-pic-test-case-for-PE-target.patch
>>>
>>>  From 616e43ac41879040e73a266065874148553cddcc Mon Sep 17 00:00:00 2001
>>> From: Jonathan Yong<10walls@gmail.com>
>>> Date: Tue, 14 Feb 2023 10:37:03 +0000
>>> Subject: [PATCH 2/2] gcc/testsuite/gcc.dg: fix pic test case for PE 
>>> targets
>>>
>>> gcc/testsuite/ChangeLog:
>>>
>>>     * pic-2.c: fix expected __PIC__ value.
>>>     * pic-3.c: ditto.
>>>     * pic-4.c: ditto.
>> Please adjust your ChangeLog entries slightly, in particular, please 
>> capitalize the first letter in each ChangeLog entry.  ie, fix->Fix, 
>> ditto->Ditto.
>>
>> Presumably the windows platforms are not always PIC and thus should 
>> not be handled in a manner similar to MIPS?
>>
>> Assuming that's the case, then this patch is OK with the trivial 
>> ChangeLog fixes.
>>
>>
> 
> Windows code is effectively always PIC, since the PE loader can relocate 
> it anywhere if the preferred address is already occupied. Patch still OK?
Yes, still OK.  Just make the trivial ChangeLog adjustments.

Thanks,
jeff

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Patch] More LLP64 fixes and __PIC__ values fixes for PE targets
  2023-03-12 16:54     ` Jeff Law
@ 2023-03-15  0:12       ` Jonathan Yong
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Yong @ 2023-03-15  0:12 UTC (permalink / raw)
  To: Jeff Law, Gcc Patch List, NightStrike

On 3/12/23 16:54, Jeff Law wrote:
> 
>>
>> Windows code is effectively always PIC, since the PE loader can 
>> relocate it anywhere if the preferred address is already occupied. 
>> Patch still OK?
> Yes, still OK.  Just make the trivial ChangeLog adjustments.
> 

Done, pushed to master branch, thanks.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-03-15  0:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-14 10:42 [Patch] More LLP64 fixes and __PIC__ values fixes for PE targets Jonathan Yong
2023-02-26  5:12 ` NightStrike
2023-03-11 17:29 ` Jeff Law
2023-03-12  1:54   ` Jonathan Yong
2023-03-12 16:54     ` Jeff Law
2023-03-15  0:12       ` Jonathan Yong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).