public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [testsuite] PATCH: Ignore additional messages on Linux/x86 with PIE
@ 2015-01-12  0:31 H.J. Lu
  2015-01-15 16:30 ` Mike Stump
  0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu @ 2015-01-12  0:31 UTC (permalink / raw)
  To: gcc-patches

g++.dg/other/anon5.C is expected to fail to link.  On Linux/x86 with PIE,
there are additional messages linker:

[hjl@gnu-tools-1 gcc]$ g++  -fPIE -pie
/export/gnu/import/git/sources/gcc/gcc/testsuite/g++.dg/other/anon5.C
/tmp/ccwg53fj.o: In function `f()': anon5.C:(.text+0x7): undefined reference to `(anonymous namespace)::c::t'
/usr/local/bin/ld: /tmp/ccwg53fj.o: relocation R_X86_64_PC32 against undefined symbol `_ZN12_GLOBAL__N_11c1tE' can not be used when making a shared object; recompile with -fPIC
/usr/local/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
[hjl@gnu-tools-1 gcc]$ 

This patch ignores additional messages on Linux/x86 with PIE.  OK for
trunk?

Thanks.

H.J.
---
 gcc/testsuite/g++.dg/other/anon5.C | 2 ++
 1 file changed, 2 insertions(+)

2015-01-11  H.J. Lu  <hongjiu.lu@intel.com>

	* g++.dg/other/anon5.C: Ignore additional messages on Linux/x86
	with PIE.

diff --git a/gcc/testsuite/g++.dg/other/anon5.C b/gcc/testsuite/g++.dg/other/anon5.C
index 81e9def..4e4cc44 100644
--- a/gcc/testsuite/g++.dg/other/anon5.C
+++ b/gcc/testsuite/g++.dg/other/anon5.C
@@ -3,6 +3,8 @@
 // { dg-options "-g" }
 // Ignore additional message on powerpc-ibm-aix
 // { dg-prune-output "obtain more information" } */
+// Ignore additional messages on Linux/x86 with PIE
+// { dg-prune-output "Bad value" } */
 
 namespace {
   struct c
-- 
1.9.3

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

* Re: [testsuite] PATCH: Ignore additional messages on Linux/x86 with PIE
  2015-01-12  0:31 [testsuite] PATCH: Ignore additional messages on Linux/x86 with PIE H.J. Lu
@ 2015-01-15 16:30 ` Mike Stump
  2015-01-15 16:36   ` H.J. Lu
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Stump @ 2015-01-15 16:30 UTC (permalink / raw)
  To: H.J. Lu; +Cc: gcc-patches

So, I was hoping that someone would step forward and review this.  I’d like for a reviewer to consider, is this the type of error messages we want to vend to the poor user?  It strikes me as, well, icky.  Should -fPIE imply -fPIC?

Exclusive of that issue, the patch is fine.

On Jan 11, 2015, at 4:23 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> g++.dg/other/anon5.C is expected to fail to link.  On Linux/x86 with PIE,
> there are additional messages linker:
> 
> [hjl@gnu-tools-1 gcc]$ g++  -fPIE -pie
> /export/gnu/import/git/sources/gcc/gcc/testsuite/g++.dg/other/anon5.C
> /tmp/ccwg53fj.o: In function `f()': anon5.C:(.text+0x7): undefined reference to `(anonymous namespace)::c::t'
> /usr/local/bin/ld: /tmp/ccwg53fj.o: relocation R_X86_64_PC32 against undefined symbol `_ZN12_GLOBAL__N_11c1tE' can not be used when making a shared object; recompile with -fPIC
> /usr/local/bin/ld: final link failed: Bad value
> collect2: error: ld returned 1 exit status
> [hjl@gnu-tools-1 gcc]$ 
> 
> This patch ignores additional messages on Linux/x86 with PIE.  OK for
> trunk?
> 
> Thanks.
> 
> H.J.
> ---
> gcc/testsuite/g++.dg/other/anon5.C | 2 ++
> 1 file changed, 2 insertions(+)
> 
> 2015-01-11  H.J. Lu  <hongjiu.lu@intel.com>
> 
> 	* g++.dg/other/anon5.C: Ignore additional messages on Linux/x86
> 	with PIE.
> 
> diff --git a/gcc/testsuite/g++.dg/other/anon5.C b/gcc/testsuite/g++.dg/other/anon5.C
> index 81e9def..4e4cc44 100644
> --- a/gcc/testsuite/g++.dg/other/anon5.C
> +++ b/gcc/testsuite/g++.dg/other/anon5.C
> @@ -3,6 +3,8 @@
> // { dg-options "-g" }
> // Ignore additional message on powerpc-ibm-aix
> // { dg-prune-output "obtain more information" } */
> +// Ignore additional messages on Linux/x86 with PIE
> +// { dg-prune-output "Bad value" } */
> 
> namespace {
>   struct c

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

* Re: [testsuite] PATCH: Ignore additional messages on Linux/x86 with PIE
  2015-01-15 16:30 ` Mike Stump
@ 2015-01-15 16:36   ` H.J. Lu
  2015-01-15 17:23     ` H.J. Lu
  0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu @ 2015-01-15 16:36 UTC (permalink / raw)
  To: Mike Stump; +Cc: GCC Patches

On Thu, Jan 15, 2015 at 8:24 AM, Mike Stump <mikestump@comcast.net> wrote:
> So, I was hoping that someone would step forward and review this.  I’d like for a reviewer to consider, is this the type of error messages we want to vend to the poor user?  It strikes me as, well, icky.  Should -fPIE imply -fPIC?

It is an optimization:

https://gcc.gnu.org/ml/gcc-cvs/2014-12/msg00206.html

If linker supports copy reloc in PIE, we turn off PIC for the data access.
Since the symbol is undefined in this case, linker complains.

> Exclusive of that issue, the patch is fine.

I will check it in.

Thanks.

> On Jan 11, 2015, at 4:23 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> g++.dg/other/anon5.C is expected to fail to link.  On Linux/x86 with PIE,
>> there are additional messages linker:
>>
>> [hjl@gnu-tools-1 gcc]$ g++  -fPIE -pie
>> /export/gnu/import/git/sources/gcc/gcc/testsuite/g++.dg/other/anon5.C
>> /tmp/ccwg53fj.o: In function `f()': anon5.C:(.text+0x7): undefined reference to `(anonymous namespace)::c::t'
>> /usr/local/bin/ld: /tmp/ccwg53fj.o: relocation R_X86_64_PC32 against undefined symbol `_ZN12_GLOBAL__N_11c1tE' can not be used when making a shared object; recompile with -fPIC
>> /usr/local/bin/ld: final link failed: Bad value
>> collect2: error: ld returned 1 exit status
>> [hjl@gnu-tools-1 gcc]$
>>
>> This patch ignores additional messages on Linux/x86 with PIE.  OK for
>> trunk?
>>
>> Thanks.
>>
>> H.J.
>> ---
>> gcc/testsuite/g++.dg/other/anon5.C | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> 2015-01-11  H.J. Lu  <hongjiu.lu@intel.com>
>>
>>       * g++.dg/other/anon5.C: Ignore additional messages on Linux/x86
>>       with PIE.
>>
>> diff --git a/gcc/testsuite/g++.dg/other/anon5.C b/gcc/testsuite/g++.dg/other/anon5.C
>> index 81e9def..4e4cc44 100644
>> --- a/gcc/testsuite/g++.dg/other/anon5.C
>> +++ b/gcc/testsuite/g++.dg/other/anon5.C
>> @@ -3,6 +3,8 @@
>> // { dg-options "-g" }
>> // Ignore additional message on powerpc-ibm-aix
>> // { dg-prune-output "obtain more information" } */
>> +// Ignore additional messages on Linux/x86 with PIE
>> +// { dg-prune-output "Bad value" } */
>>
>> namespace {
>>   struct c



-- 
H.J.

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

* Re: [testsuite] PATCH: Ignore additional messages on Linux/x86 with PIE
  2015-01-15 16:36   ` H.J. Lu
@ 2015-01-15 17:23     ` H.J. Lu
  0 siblings, 0 replies; 4+ messages in thread
From: H.J. Lu @ 2015-01-15 17:23 UTC (permalink / raw)
  To: Mike Stump; +Cc: GCC Patches

On Thu, Jan 15, 2015 at 8:30 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, Jan 15, 2015 at 8:24 AM, Mike Stump <mikestump@comcast.net> wrote:
>> So, I was hoping that someone would step forward and review this.  I’d like for a reviewer to consider, is this the type of error messages we want to vend to the poor user?  It strikes me as, well, icky.  Should -fPIE imply -fPIC?
>
> It is an optimization:
>
> https://gcc.gnu.org/ml/gcc-cvs/2014-12/msg00206.html
>
> If linker supports copy reloc in PIE, we turn off PIC for the data access.
> Since the symbol is undefined in this case, linker complains.
>

FYI, I opened a linker bug:

https://sourceware.org/bugzilla/show_bug.cgi?id=17847

I will suppress the second linker message.

-- 
H.J.

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

end of thread, other threads:[~2015-01-15 17:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-12  0:31 [testsuite] PATCH: Ignore additional messages on Linux/x86 with PIE H.J. Lu
2015-01-15 16:30 ` Mike Stump
2015-01-15 16:36   ` H.J. Lu
2015-01-15 17:23     ` H.J. Lu

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).