public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [PATCH] [Microblaze]: PIC Data Text Relative
       [not found] <CAE=jbAMyXXpWUPnC_dcmyWNeOXcJ-Wo4+KomQ9KwpX2KuLDqkg@mail.gmail.com>
@ 2018-02-27  0:07 ` Michael Eager
  2018-02-27  8:14   ` Andrew Sadek
  0 siblings, 1 reply; 27+ messages in thread
From: Michael Eager @ 2018-02-27  0:07 UTC (permalink / raw)
  To: Andrew Guirguis; +Cc: gcc-patches, gdb-patches, binutils

On 02/25/2018 11:44 PM, Andrew Guirguis wrote:
> Dears,
> 
> Kindly find attached the patch bundle for Microblaze 
> '-mpic-data-text-relative' feature.
> 
> Description of the feature in the following link:
> https://github.com/andrewsadek/microblaze-pic-data-text-rel/blob/pic_data_text_rel/README.md 
> <https://github.com/andrewsadek/microblaze-pic-data-text-rel/blob/pic_data_text_rel/README.md>
> 
> Bundle includes:
> 1) Change logs for GCC, binutils
> 2) GCC Test results and comparison with the original.
> 3) New Test case (picdtr.c)
> 4) The Patches (against current heads)

Hi Andrew --

Thanks for the submission.  I have the following recommendations:

Submit each patch to the appropriate project mailing list.  Only submit
the patch for the specific project, without patches for other projects.

Include a description of the changes with each patch as well as the
changelog.  Include the patch in your email or as an attachment.

It isn't clear why you sent your submission to the gdb-patches mailing
list, since there don't appear to be any GDB changes.  Conversely, it is
not clear why you did not include the binutils mailing list, since you
include a patch to that project.

Be sure to follow GNU coding conventions,  Check brace placement,
indent, maximum line length, if statements, etc.  I noticed a number
of places where these conventions are not followed in your patches.

GCC regression tests should include all tests (e.g., gcc.dg), not just 
the limited number of MicroBlaze-specific tests.

-- 
Michael Eager    eager@eagerm.com
1960 Park Blvd., Palo Alto, CA 94306

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

* Re: [PATCH] [Microblaze]: PIC Data Text Relative
  2018-02-27  0:07 ` [PATCH] [Microblaze]: PIC Data Text Relative Michael Eager
@ 2018-02-27  8:14   ` Andrew Sadek
  2018-03-02 16:12     ` Andrew Sadek
  0 siblings, 1 reply; 27+ messages in thread
From: Andrew Sadek @ 2018-02-27  8:14 UTC (permalink / raw)
  To: Michael Eager; +Cc: gcc-patches, gdb-patches, binutils

Thanks Micheal for your response.
I shall re-submit patches separately after re-running the whole GCC Test
suite and re-checking code conventions.
For sending to gdb-patches, it was a conflict from my side as actually I
thought it is also for binutils.

On Tue, Feb 27, 2018 at 2:07 AM, Michael Eager <eager@eagerm.com> wrote:

> On 02/25/2018 11:44 PM, Andrew Guirguis wrote:
>
>> Dears,
>>
>> Kindly find attached the patch bundle for Microblaze
>> '-mpic-data-text-relative' feature.
>>
>> Description of the feature in the following link:
>> https://github.com/andrewsadek/microblaze-pic-data-text-rel/
>> blob/pic_data_text_rel/README.md <https://github.com/andrewsade
>> k/microblaze-pic-data-text-rel/blob/pic_data_text_rel/README.md>
>>
>> Bundle includes:
>> 1) Change logs for GCC, binutils
>> 2) GCC Test results and comparison with the original.
>> 3) New Test case (picdtr.c)
>> 4) The Patches (against current heads)
>>
>
> Hi Andrew --
>
> Thanks for the submission.  I have the following recommendations:
>
> Submit each patch to the appropriate project mailing list.  Only submit
> the patch for the specific project, without patches for other projects.
>
> Include a description of the changes with each patch as well as the
> changelog.  Include the patch in your email or as an attachment.
>
> It isn't clear why you sent your submission to the gdb-patches mailing
> list, since there don't appear to be any GDB changes.  Conversely, it is
> not clear why you did not include the binutils mailing list, since you
> include a patch to that project.
>
> Be sure to follow GNU coding conventions,  Check brace placement,
> indent, maximum line length, if statements, etc.  I noticed a number
> of places where these conventions are not followed in your patches.
>
> GCC regression tests should include all tests (e.g., gcc.dg), not just the
> limited number of MicroBlaze-specific tests.
>
> --
> Michael Eager    eager@eagerm.com
> 1960 Park Blvd., Palo Alto, CA 94306
>



-- 

Andrew

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

* Re: [PATCH] [Microblaze]: PIC Data Text Relative
  2018-02-27  8:14   ` Andrew Sadek
@ 2018-03-02 16:12     ` Andrew Sadek
  2018-03-05 19:21       ` Michael Eager
  0 siblings, 1 reply; 27+ messages in thread
From: Andrew Sadek @ 2018-03-02 16:12 UTC (permalink / raw)
  To: Michael Eager; +Cc: gcc-patches

Hello Michael,

I tried running the whole GCC test suite on the current head (without my
patch) along with 'microblaze-qemu' but I have the following problems:

1) The test is hanging at 'gcc.c-torture/string-large-1.c' , the gcc is
making a 100% CPU usage and the machine stucks.
I tried compiling the file alone, it generated a couple of warnings than it
hangs.
 warning: '__builtin_memchr' specified size 4294967295 exceeds maximum
object size 2147483647 [-Wstringop-overflow=]
   vp1 = __builtin_memchr (a, b, SIZE1);

Is it a bug? Is there something wrong with my configuration ?
GCC configured with options :  --with-newlib --enable-threads=no
--disable-shared --with-pkgversion='crosstool-NG
crosstool-ng-1.23.0-280-g01e3290' --enable-__cxa_atexit --disable-libgomp
--disable-libmudflap --disable-libmpx --disable-libssp
--disable-libquadmath --disable-libquadmath-support --enable-lto
--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm'
--enable-target-optspace --disable-nls --enable-multiarch
--enable-languages=c,c++

2) For running QEMU, I have no problem with elf execution. But I do not
know how to auto terminate the QEMU itself  as it remains up even after
program execution.
Is there some command to be passed to QEMU in order make system shut down
after program termination with its exit code ?


On Tue, Feb 27, 2018 at 10:13 AM, Andrew Sadek <andrew.sadek.se@gmail.com>
wrote:

> Thanks Micheal for your response.
> I shall re-submit patches separately after re-running the whole GCC Test
> suite and re-checking code conventions.
> For sending to gdb-patches, it was a conflict from my side as actually I
> thought it is also for binutils.
>
> On Tue, Feb 27, 2018 at 2:07 AM, Michael Eager <eager@eagerm.com> wrote:
>
>> On 02/25/2018 11:44 PM, Andrew Guirguis wrote:
>>
>>> Dears,
>>>
>>> Kindly find attached the patch bundle for Microblaze
>>> '-mpic-data-text-relative' feature.
>>>
>>> Description of the feature in the following link:
>>> https://github.com/andrewsadek/microblaze-pic-data-text-rel/
>>> blob/pic_data_text_rel/README.md <https://github.com/andrewsade
>>> k/microblaze-pic-data-text-rel/blob/pic_data_text_rel/README.md>
>>>
>>> Bundle includes:
>>> 1) Change logs for GCC, binutils
>>> 2) GCC Test results and comparison with the original.
>>> 3) New Test case (picdtr.c)
>>> 4) The Patches (against current heads)
>>>
>>
>> Hi Andrew --
>>
>> Thanks for the submission.  I have the following recommendations:
>>
>> Submit each patch to the appropriate project mailing list.  Only submit
>> the patch for the specific project, without patches for other projects.
>>
>> Include a description of the changes with each patch as well as the
>> changelog.  Include the patch in your email or as an attachment.
>>
>> It isn't clear why you sent your submission to the gdb-patches mailing
>> list, since there don't appear to be any GDB changes.  Conversely, it is
>> not clear why you did not include the binutils mailing list, since you
>> include a patch to that project.
>>
>> Be sure to follow GNU coding conventions,  Check brace placement,
>> indent, maximum line length, if statements, etc.  I noticed a number
>> of places where these conventions are not followed in your patches.
>>
>> GCC regression tests should include all tests (e.g., gcc.dg), not just
>> the limited number of MicroBlaze-specific tests.
>>
>> --
>> Michael Eager    eager@eagerm.com
>> 1960 Park Blvd., Palo Alto, CA 94306
>>
>
>
>
> --
>
> Andrew
>



-- 

Andrew

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

* Re: [PATCH] [Microblaze]: PIC Data Text Relative
  2018-03-02 16:12     ` Andrew Sadek
@ 2018-03-05 19:21       ` Michael Eager
  2018-03-12 13:19         ` Andrew Sadek
  0 siblings, 1 reply; 27+ messages in thread
From: Michael Eager @ 2018-03-05 19:21 UTC (permalink / raw)
  To: Andrew Sadek; +Cc: gcc-patches

On 03/02/2018 08:12 AM, Andrew Sadek wrote:
> Hello Michael,
> 
> I tried running the whole GCC test suite on the current head (without my 
> patch) along with 'microblaze-qemu' but I have the following problems:
> 
> 1) The test is hanging at 'gcc.c-torture/string-large-1.c' , the gcc is 
> making a 100% CPU usage and the machine stucks.
> I tried compiling the file alone, it generated a couple of warnings than 
> it hangs.
>   warning: '__builtin_memchr' specified size 4294967295 exceeds maximum 
> object size 2147483647 [-Wstringop-overflow=]
>     vp1 = __builtin_memchr (a, b, SIZE1);
> 
> Is it a bug? Is there something wrong with my configuration ?
> GCC configured with options :  --with-newlib --enable-threads=no 
> --disable-shared --with-pkgversion='crosstool-NG 
> crosstool-ng-1.23.0-280-g01e3290' --enable-__cxa_atexit 
> --disable-libgomp --disable-libmudflap --disable-libmpx --disable-libssp 
> --disable-libquadmath --disable-libquadmath-support --enable-lto 
> --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic 
> -lm' --enable-target-optspace --disable-nls --enable-multiarch 
> --enable-languages=c,c++

Your configuration is more complex than my hard-metal target version,
but it looks reasonable.

The problem with string-large-1.c does appear to be a bug.  You can
add a line to the test case which will mark it as known failure for MB:

   /* { dg-xfail-if "exceeds maximum" { microblaze-*-* } } */

(I have not tested this, but it should work.  Compare with other
xfail's.)

> 2) For running QEMU, I have no problem with elf execution. But I do not 
> know how to auto terminate the QEMU itself  as it remains up even after 
> program execution.
> Is there some command to be passed to QEMU in order make system shut 
> down after program termination with its exit code ?

Yes, this is a problem.  For other targets using QEMU I have added dummy
HLT instructions to terminate QEMU, or used a wrapper around QEMU which
sets breakpoints at exit (or _exit) and stops the simulator when hit.

If you are running Linux on QEMU, instead of using QEMU's built-in gdb
interface you might use the Linux system as the target for the test
suite, running gdbserver on the target.

> 
> 
> On Tue, Feb 27, 2018 at 10:13 AM, Andrew Sadek 
> <andrew.sadek.se@gmail.com <mailto:andrew.sadek.se@gmail.com>> wrote:
> 
>     Thanks Micheal for your response.
>     I shall re-submit patches separately after re-running the whole GCC
>     Test suite and re-checking code conventions.
>     For sending to gdb-patches, it was a conflict from my side as
>     actually I thought it is also for binutils.
> 
>     On Tue, Feb 27, 2018 at 2:07 AM, Michael Eager <eager@eagerm.com
>     <mailto:eager@eagerm.com>> wrote:
> 
>         On 02/25/2018 11:44 PM, Andrew Guirguis wrote:
> 
>             Dears,
> 
>             Kindly find attached the patch bundle for Microblaze
>             '-mpic-data-text-relative' feature.
> 
>             Description of the feature in the following link:
>             https://github.com/andrewsadek/microblaze-pic-data-text-rel/blob/pic_data_text_rel/README.md
>             <https://github.com/andrewsadek/microblaze-pic-data-text-rel/blob/pic_data_text_rel/README.md>
>             <https://github.com/andrewsadek/microblaze-pic-data-text-rel/blob/pic_data_text_rel/README.md
>             <https://github.com/andrewsadek/microblaze-pic-data-text-rel/blob/pic_data_text_rel/README.md>>
> 
>             Bundle includes:
>             1) Change logs for GCC, binutils
>             2) GCC Test results and comparison with the original.
>             3) New Test case (picdtr.c)
>             4) The Patches (against current heads)
> 
> 
>         Hi Andrew --
> 
>         Thanks for the submission.  I have the following recommendations:
> 
>         Submit each patch to the appropriate project mailing list.  Only
>         submit
>         the patch for the specific project, without patches for other
>         projects.
> 
>         Include a description of the changes with each patch as well as the
>         changelog.  Include the patch in your email or as an attachment.
> 
>         It isn't clear why you sent your submission to the gdb-patches
>         mailing
>         list, since there don't appear to be any GDB changes. 
>         Conversely, it is
>         not clear why you did not include the binutils mailing list,
>         since you
>         include a patch to that project.
> 
>         Be sure to follow GNU coding conventions,  Check brace placement,
>         indent, maximum line length, if statements, etc.  I noticed a number
>         of places where these conventions are not followed in your patches.
> 
>         GCC regression tests should include all tests (e.g., gcc.dg),
>         not just the limited number of MicroBlaze-specific tests.
> 
>         -- 
>         Michael Eager eager@eagerm.com <mailto:eager@eagerm.com>
>         1960 Park Blvd., Palo Alto, CA 94306
> 
> 
> 
> 
>     -- 
> 
>     Andrew
> 
> 
> 
> 
> -- 
> 
> Andrew

-- 
Michael Eager    eager@eagerm.com
1960 Park Blvd., Palo Alto, CA 94306

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

* Re: [PATCH] [Microblaze]: PIC Data Text Relative
  2018-03-05 19:21       ` Michael Eager
@ 2018-03-12 13:19         ` Andrew Sadek
  2018-03-12 14:30           ` Michael Eager
  0 siblings, 1 reply; 27+ messages in thread
From: Andrew Sadek @ 2018-03-12 13:19 UTC (permalink / raw)
  To: Michael Eager; +Cc: gcc-patches

On Mon, Mar 5, 2018 at 9:21 PM, Michael Eager <eager@eagerm.com> wrote:

> On 03/02/2018 08:12 AM, Andrew Sadek wrote:
>
>> Hello Michael,
>>
>> I tried running the whole GCC test suite on the current head (without my
>> patch) along with 'microblaze-qemu' but I have the following problems:
>>
>> 1) The test is hanging at 'gcc.c-torture/string-large-1.c' , the gcc is
>> making a 100% CPU usage and the machine stucks.
>> I tried compiling the file alone, it generated a couple of warnings than
>> it hangs.
>>   warning: '__builtin_memchr' specified size 4294967295 exceeds maximum
>> object size 2147483647 [-Wstringop-overflow=]
>>     vp1 = __builtin_memchr (a, b, SIZE1);
>>
>> Is it a bug? Is there something wrong with my configuration ?
>> GCC configured with options :  --with-newlib --enable-threads=no
>> --disable-shared --with-pkgversion='crosstool-NG
>> crosstool-ng-1.23.0-280-g01e3290' --enable-__cxa_atexit
>> --disable-libgomp --disable-libmudflap --disable-libmpx --disable-libssp
>> --disable-libquadmath --disable-libquadmath-support --enable-lto
>> --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic
>> -lm' --enable-target-optspace --disable-nls --enable-multiarch
>> --enable-languages=c,c++
>>
>
> Your configuration is more complex than my hard-metal target version,
> but it looks reasonable.
>
> The problem with string-large-1.c does appear to be a bug.  You can
> add a line to the test case which will mark it as known failure for MB:
>
>   /* { dg-xfail-if "exceeds maximum" { microblaze-*-* } } */
>
> (I have not tested this, but it should work.  Compare with other
> xfail's.)


Problem that the whole compile package is invoked with '-w' which inhibits
all warnings and overrides ' -Werror' as well as ' -Wfatal-errors' .
As a result, the warning message does not appear when running compile.exp.
Any suggestions ? Do I remove the '-w' ?


>
>
> 2) For running QEMU, I have no problem with elf execution. But I do not
>> know how to auto terminate the QEMU itself  as it remains up even after
>> program execution.
>> Is there some command to be passed to QEMU in order make system shut down
>> after program termination with its exit code ?
>>
>
> Yes, this is a problem.  For other targets using QEMU I have added dummy
> HLT instructions to terminate QEMU, or used a wrapper around QEMU which
> sets breakpoints at exit (or _exit) and stops the simulator when hit.
>
> If you are running Linux on QEMU, instead of using QEMU's built-in gdb
> interface you might use the Linux system as the target for the test
> suite, running gdbserver on the target.
>

I have finally managed to fully run QEMU with test suite but had to make a
local modification in the QEMU code itself.
In the translate function, I make a check if "bri 0" is reached which is
the '_exit'. Then, abort the QEMU app with the exit code stored in 'r5'.

Here are the results below:
*Without Patch:*
=== gcc Summary ===

# of expected passes 90776
# of unexpected failures         1317
# of unexpected successes 3
# of expected failures 207
# of unresolved testcases 115
# of unsupported tests 2828

*With Patch and after adding my test case:*
=== gcc Summary ===

# of expected passes 90790
# of unexpected failures         1317
# of unexpected successes 3
# of expected failures 207
# of unresolved testcases 115
# of unsupported tests 2828

Most of failures are in gcc.dg/pch folder => 'undefined reference main',
and in 'gcc.dg/torture/stackalign/' folder => 'undefined reference to
`_GLOBAL_OFFSET_TABLE_'

Please tell me if testing is on the right track and if any further
adaptations are needed.
Thanks.


>
>
>>
>> On Tue, Feb 27, 2018 at 10:13 AM, Andrew Sadek <andrew.sadek.se@gmail.com
>> <mailto:andrew.sadek.se@gmail.com>> wrote:
>>
>>     Thanks Micheal for your response.
>>     I shall re-submit patches separately after re-running the whole GCC
>>     Test suite and re-checking code conventions.
>>     For sending to gdb-patches, it was a conflict from my side as
>>     actually I thought it is also for binutils.
>>
>>     On Tue, Feb 27, 2018 at 2:07 AM, Michael Eager <eager@eagerm.com
>>     <mailto:eager@eagerm.com>> wrote:
>>
>>         On 02/25/2018 11:44 PM, Andrew Guirguis wrote:
>>
>>             Dears,
>>
>>             Kindly find attached the patch bundle for Microblaze
>>             '-mpic-data-text-relative' feature.
>>
>>             Description of the feature in the following link:
>>             https://github.com/andrewsadek/microblaze-pic-data-text-rel/
>> blob/pic_data_text_rel/README.md
>>             <https://github.com/andrewsadek/microblaze-pic-data-text-
>> rel/blob/pic_data_text_rel/README.md>
>>             <https://github.com/andrewsadek/microblaze-pic-data-text-
>> rel/blob/pic_data_text_rel/README.md
>>             <https://github.com/andrewsadek/microblaze-pic-data-text-
>> rel/blob/pic_data_text_rel/README.md>>
>>
>>             Bundle includes:
>>             1) Change logs for GCC, binutils
>>             2) GCC Test results and comparison with the original.
>>             3) New Test case (picdtr.c)
>>             4) The Patches (against current heads)
>>
>>
>>         Hi Andrew --
>>
>>         Thanks for the submission.  I have the following recommendations:
>>
>>         Submit each patch to the appropriate project mailing list.  Only
>>         submit
>>         the patch for the specific project, without patches for other
>>         projects.
>>
>>         Include a description of the changes with each patch as well as
>> the
>>         changelog.  Include the patch in your email or as an attachment.
>>
>>         It isn't clear why you sent your submission to the gdb-patches
>>         mailing
>>         list, since there don't appear to be any GDB changes.
>>  Conversely, it is
>>         not clear why you did not include the binutils mailing list,
>>         since you
>>         include a patch to that project.
>>
>>         Be sure to follow GNU coding conventions,  Check brace placement,
>>         indent, maximum line length, if statements, etc.  I noticed a
>> number
>>         of places where these conventions are not followed in your
>> patches.
>>
>>         GCC regression tests should include all tests (e.g., gcc.dg),
>>         not just the limited number of MicroBlaze-specific tests.
>>
>>         --         Michael Eager eager@eagerm.com <mailto:
>> eager@eagerm.com>
>>         1960 Park Blvd., Palo Alto, CA 94306
>>
>>
>>
>>
>>     --
>>     Andrew
>>
>>
>>
>>
>> --
>>
>> Andrew
>>
>
> --
> Michael Eager    eager@eagerm.com
> 1960 Park Blvd., Palo Alto, CA 94306
>



-- 

Andrew

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

* Re: [PATCH] [Microblaze]: PIC Data Text Relative
  2018-03-12 13:19         ` Andrew Sadek
@ 2018-03-12 14:30           ` Michael Eager
  2018-03-13  6:10             ` Andrew Sadek
  0 siblings, 1 reply; 27+ messages in thread
From: Michael Eager @ 2018-03-12 14:30 UTC (permalink / raw)
  To: Andrew Sadek; +Cc: gcc-patches

On 03/12/18 06:19, Andrew Sadek wrote:
> 
> 
> On Mon, Mar 5, 2018 at 9:21 PM, Michael Eager <eager@eagerm.com 
> <mailto:eager@eagerm.com>> wrote:
> 
>     On 03/02/2018 08:12 AM, Andrew Sadek wrote:
> 
>         Hello Michael,
> 
>         I tried running the whole GCC test suite on the current head
>         (without my patch) along with 'microblaze-qemu' but I have the
>         following problems:
> 
>         1) The test is hanging at 'gcc.c-torture/string-large-1.c' , the
>         gcc is making a 100% CPU usage and the machine stucks.
>         I tried compiling the file alone, it generated a couple of
>         warnings than it hangs.
>            warning: '__builtin_memchr' specified size 4294967295 exceeds
>         maximum object size 2147483647 [-Wstringop-overflow=]
>              vp1 = __builtin_memchr (a, b, SIZE1);
> 
>         Is it a bug? Is there something wrong with my configuration ?
>         GCC configured with options :  --with-newlib --enable-threads=no
>         --disable-shared --with-pkgversion='crosstool-NG
>         crosstool-ng-1.23.0-280-g01e3290' --enable-__cxa_atexit
>         --disable-libgomp --disable-libmudflap --disable-libmpx
>         --disable-libssp --disable-libquadmath
>         --disable-libquadmath-support --enable-lto
>         --with-host-libstdcxx='-static-libgcc
>         -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --enable-target-optspace
>         --disable-nls --enable-multiarch --enable-languages=c,c++
> 
> 
>     Your configuration is more complex than my hard-metal target version,
>     but it looks reasonable.
> 
>     The problem with string-large-1.c does appear to be a bug.  You can
>     add a line to the test case which will mark it as known failure for MB:
> 
>        /* { dg-xfail-if "exceeds maximum" { microblaze-*-* } } */
> 
>     (I have not tested this, but it should work.  Compare with other
>     xfail's.)
> 
> 
> Problem that the whole compile package is invoked with '-w' which 
> inhibits all warnings and overrides ' -Werror' as well as ' 
> -Wfatal-errors' .
> As a result, the warning message does not appear when running 
> compile.exp. Any suggestions ? Do I remove the '-w' ?
> 
> 
> 
>         2) For running QEMU, I have no problem with elf execution. But I
>         do not know how to auto terminate the QEMU itself  as it remains
>         up even after program execution.
>         Is there some command to be passed to QEMU in order make system
>         shut down after program termination with its exit code ?
> 
> 
>     Yes, this is a problem.  For other targets using QEMU I have added dummy
>     HLT instructions to terminate QEMU, or used a wrapper around QEMU which
>     sets breakpoints at exit (or _exit) and stops the simulator when hit.
> 
>     If you are running Linux on QEMU, instead of using QEMU's built-in gdb
>     interface you might use the Linux system as the target for the test
>     suite, running gdbserver on the target.
> 
> 
> I have finally managed to fully run QEMU with test suite but had to make 
> a local modification in the QEMU code itself.
> In the translate function, I make a check if "bri 0" is reached which is 
> the '_exit'. Then, abort the QEMU app with the exit code stored in 'r5'.

I've done essentially the same for other targets.

> Here are the results below:
> _Without Patch:_
> === gcc Summary ===
> 
> # of expected passes90776
> # of unexpected failures        1317
> # of unexpected successes3
> # of expected failures207
> # of unresolved testcases115
> # of unsupported tests2828
> 
> _With Patch and after adding my test case:_
> === gcc Summary ===
> 
> # of expected passes90790
> # of unexpected failures1317
> # of unexpected successes3
> # of expected failures207
> # of unresolved testcases115
> # of unsupported tests2828

This appears to be reasonable results.  It appears that there are no 
regressions.

Please send me the mb-gcc command line options for both of these test runs.



-- 
Michael Eager    eager@eagerm.com
1960 Park Blvd., Palo Alto, CA 94306

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

* Re: [PATCH] [Microblaze]: PIC Data Text Relative
  2018-03-12 14:30           ` Michael Eager
@ 2018-03-13  6:10             ` Andrew Sadek
  2018-03-13  6:42               ` Michael Eager
  0 siblings, 1 reply; 27+ messages in thread
From: Andrew Sadek @ 2018-03-13  6:10 UTC (permalink / raw)
  To: Michael Eager; +Cc: gcc-patches

*Command for running testsuite:*

*make -k check-gcc RUNTESTFLAGS="-v --target_board=microblaze-qemu
CFLAGS_FOR_TARGET='-include /home/andrew/qemu/common.h
-L/home/andrew/qemu/lib -Wl,--start-group,-lxil,-lgcc,-lc,--end-group
-mlittle-endian' "*

*Quick Details:*
1) common.h: Here I define 'STACK_SIZE' with (0x4000) as it's used in some
test cases.
2) -L ..... /lib: it contains libm, libc in little endian since we use
'qemu-system-microblazeel', and libxil which is the libgloss + some
additional features (read, write, inbyte, outbyte) built with Xilinx SDK.

*mb-gcc command example from gcc.log:*

Testing execute/va-arg-15.c,   -O1
doing compile
Executing on host:*
/home/andrew/gcc_workspace/gcc_orig/microblaze-xilinx-elf/build/build-cc-gcc-final/gcc/xgcc
-B/home/andrew/gcc_workspace/gcc_orig/microblaze-xilinx-elf/build/build-cc-gcc-final/gcc/
/home/andrew/gcc_workspace/gcc_orig/microblaze-xilinx-elf/src/gcc/gcc/testsuite/gcc.c-torture/execute/va-arg-15.c
  -include /home/andrew/qemu/common.h -L/home/andrew/qemu/lib
-Wl,--start-group,-lxil,-lgcc,-lc,--end-group -mlittle-endian
-fno-diagnostics-show-caret -fdiagnostics-color=never    -O1  -w
-T/home/andrew/qemu/qemu/microblazeel-softmmu/xilinx.ld  -lm  -o
./va-arg-15.exe    (timeout = 300)*



On Mon, Mar 12, 2018 at 4:30 PM, Michael Eager <eager@eagerm.com> wrote:

> On 03/12/18 06:19, Andrew Sadek wrote:
>
>
>>
>> On Mon, Mar 5, 2018 at 9:21 PM, Michael Eager <eager@eagerm.com <mailto:
>> eager@eagerm.com>> wrote:
>>
>>     On 03/02/2018 08:12 AM, Andrew Sadek wrote:
>>
>>         Hello Michael,
>>
>>         I tried running the whole GCC test suite on the current head
>>         (without my patch) along with 'microblaze-qemu' but I have the
>>         following problems:
>>
>>         1) The test is hanging at 'gcc.c-torture/string-large-1.c' , the
>>         gcc is making a 100% CPU usage and the machine stucks.
>>         I tried compiling the file alone, it generated a couple of
>>         warnings than it hangs.
>>            warning: '__builtin_memchr' specified size 4294967295 exceeds
>>         maximum object size 2147483647 [-Wstringop-overflow=]
>>              vp1 = __builtin_memchr (a, b, SIZE1);
>>
>>         Is it a bug? Is there something wrong with my configuration ?
>>         GCC configured with options :  --with-newlib --enable-threads=no
>>         --disable-shared --with-pkgversion='crosstool-NG
>>         crosstool-ng-1.23.0-280-g01e3290' --enable-__cxa_atexit
>>         --disable-libgomp --disable-libmudflap --disable-libmpx
>>         --disable-libssp --disable-libquadmath
>>         --disable-libquadmath-support --enable-lto
>>         --with-host-libstdcxx='-static-libgcc
>>         -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --enable-target-optspace
>>         --disable-nls --enable-multiarch --enable-languages=c,c++
>>
>>
>>     Your configuration is more complex than my hard-metal target version,
>>     but it looks reasonable.
>>
>>     The problem with string-large-1.c does appear to be a bug.  You can
>>     add a line to the test case which will mark it as known failure for
>> MB:
>>
>>        /* { dg-xfail-if "exceeds maximum" { microblaze-*-* } } */
>>
>>     (I have not tested this, but it should work.  Compare with other
>>     xfail's.)
>>
>>
>> Problem that the whole compile package is invoked with '-w' which
>> inhibits all warnings and overrides ' -Werror' as well as ' -Wfatal-errors'
>> .
>> As a result, the warning message does not appear when running
>> compile.exp. Any suggestions ? Do I remove the '-w' ?
>>
>>
>>
>>         2) For running QEMU, I have no problem with elf execution. But I
>>         do not know how to auto terminate the QEMU itself  as it remains
>>         up even after program execution.
>>         Is there some command to be passed to QEMU in order make system
>>         shut down after program termination with its exit code ?
>>
>>
>>     Yes, this is a problem.  For other targets using QEMU I have added
>> dummy
>>     HLT instructions to terminate QEMU, or used a wrapper around QEMU
>> which
>>     sets breakpoints at exit (or _exit) and stops the simulator when hit.
>>
>>     If you are running Linux on QEMU, instead of using QEMU's built-in gdb
>>     interface you might use the Linux system as the target for the test
>>     suite, running gdbserver on the target.
>>
>>
>> I have finally managed to fully run QEMU with test suite but had to make
>> a local modification in the QEMU code itself.
>> In the translate function, I make a check if "bri 0" is reached which is
>> the '_exit'. Then, abort the QEMU app with the exit code stored in 'r5'.
>>
>
> I've done essentially the same for other targets.
>
> Here are the results below:
>> _Without Patch:_
>> === gcc Summary ===
>>
>> # of expected passes90776
>> # of unexpected failures        1317
>> # of unexpected successes3
>> # of expected failures207
>> # of unresolved testcases115
>> # of unsupported tests2828
>>
>> _With Patch and after adding my test case:_
>> === gcc Summary ===
>>
>> # of expected passes90790
>> # of unexpected failures1317
>> # of unexpected successes3
>> # of expected failures207
>> # of unresolved testcases115
>> # of unsupported tests2828
>>
>
> This appears to be reasonable results.  It appears that there are no
> regressions.
>
> Please send me the mb-gcc command line options for both of these test runs.
>
>
>
>
> --
> Michael Eager    eager@eagerm.com
> 1960 Park Blvd., Palo Alto, CA 94306
>



-- 

Andrew

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

* Re: [PATCH] [Microblaze]: PIC Data Text Relative
  2018-03-13  6:10             ` Andrew Sadek
@ 2018-03-13  6:42               ` Michael Eager
  2018-03-13  7:56                 ` Andrew Sadek
  0 siblings, 1 reply; 27+ messages in thread
From: Michael Eager @ 2018-03-13  6:42 UTC (permalink / raw)
  To: Andrew Sadek; +Cc: gcc-patches

On 03/12/18 23:10, Andrew Sadek wrote:
> _Command for running testsuite:_
> 
> /make -k check-gcc RUNTESTFLAGS="-v --target_board=microblaze-qemu 
> CFLAGS_FOR_TARGET='-include /home/andrew/qemu/common.h 
> -L/home/andrew/qemu/lib -Wl,--start-group,-lxil,-lgcc,-lc,--end-group 
> -mlittle-endian' "/
> 
> _Quick Details:_
> 1) common.h: Here I define 'STACK_SIZE' with (0x4000) as it's used in 
> some test cases.
> 2) -L ..... /lib: it contains libm, libc in little endian since we use 
> 'qemu-system-microblazeel', and libxil which is the libgloss + some 
> additional features (read, write, inbyte, outbyte) built with Xilinx SDK.
> 
> _mb-gcc command example from gcc.log:_
> 
> Testing execute/va-arg-15.c,   -O1
> doing compile
> Executing on 
> host://home/andrew/gcc_workspace/gcc_orig/microblaze-xilinx-elf/build/build-cc-gcc-final/gcc/xgcc 
> -B/home/andrew/gcc_workspace/gcc_orig/microblaze-xilinx-elf/build/build-cc-gcc-final/gcc/ 
> /home/andrew/gcc_workspace/gcc_orig/microblaze-xilinx-elf/src/gcc/gcc/testsuite/gcc.c-torture/execute/va-arg-15.c  
>    -include /home/andrew/qemu/common.h -L/home/andrew/qemu/lib 
> -Wl,--start-group,-lxil,-lgcc,-lc,--end-group -mlittle-endian 
> -fno-diagnostics-show-caret -fdiagnostics-color=never    -O1  -w 
> -T/home/andrew/qemu/qemu/microblazeel-softmmu/xilinx.ld  -lm  -o 
> ./va-arg-15.exe    (timeout = 300)/

OK.  This shows that the patch does not cause regressions when the new 
options are not used.  That is good.

Please run the same regression test with the new PIC options.  Ideally 
you should have the same results.


> 
> 
> 
> On Mon, Mar 12, 2018 at 4:30 PM, Michael Eager <eager@eagerm.com 
> <mailto:eager@eagerm.com>> wrote:
> 
>     On 03/12/18 06:19, Andrew Sadek wrote:
> 
> 
> 
>         On Mon, Mar 5, 2018 at 9:21 PM, Michael Eager <eager@eagerm.com
>         <mailto:eager@eagerm.com> <mailto:eager@eagerm.com
>         <mailto:eager@eagerm.com>>> wrote:
> 
>              On 03/02/2018 08:12 AM, Andrew Sadek wrote:
> 
>                  Hello Michael,
> 
>                  I tried running the whole GCC test suite on the current
>         head
>                  (without my patch) along with 'microblaze-qemu' but I
>         have the
>                  following problems:
> 
>                  1) The test is hanging at
>         'gcc.c-torture/string-large-1.c' , the
>                  gcc is making a 100% CPU usage and the machine stucks.
>                  I tried compiling the file alone, it generated a couple of
>                  warnings than it hangs.
>                     warning: '__builtin_memchr' specified size
>         4294967295 exceeds
>                  maximum object size 2147483647 [-Wstringop-overflow=]
>                       vp1 = __builtin_memchr (a, b, SIZE1);
> 
>                  Is it a bug? Is there something wrong with my
>         configuration ?
>                  GCC configured with options :  --with-newlib
>         --enable-threads=no
>                  --disable-shared --with-pkgversion='crosstool-NG
>                  crosstool-ng-1.23.0-280-g01e3290' --enable-__cxa_atexit
>                  --disable-libgomp --disable-libmudflap --disable-libmpx
>                  --disable-libssp --disable-libquadmath
>                  --disable-libquadmath-support --enable-lto
>                  --with-host-libstdcxx='-static-libgcc
>                  -Wl,-Bstatic,-lstdc++,-Bdynamic -lm'
>         --enable-target-optspace
>                  --disable-nls --enable-multiarch --enable-languages=c,c++
> 
> 
>              Your configuration is more complex than my hard-metal
>         target version,
>              but it looks reasonable.
> 
>              The problem with string-large-1.c does appear to be a bug. 
>         You can
>              add a line to the test case which will mark it as known
>         failure for MB:
> 
>                 /* { dg-xfail-if "exceeds maximum" { microblaze-*-* } } */
> 
>              (I have not tested this, but it should work.  Compare with
>         other
>              xfail's.)
> 
> 
>         Problem that the whole compile package is invoked with '-w'
>         which inhibits all warnings and overrides ' -Werror' as well as
>         ' -Wfatal-errors' .
>         As a result, the warning message does not appear when running
>         compile.exp. Any suggestions ? Do I remove the '-w' ?
> 
> 
> 
>                  2) For running QEMU, I have no problem with elf
>         execution. But I
>                  do not know how to auto terminate the QEMU itself  as
>         it remains
>                  up even after program execution.
>                  Is there some command to be passed to QEMU in order
>         make system
>                  shut down after program termination with its exit code ?
> 
> 
>              Yes, this is a problem.  For other targets using QEMU I
>         have added dummy
>              HLT instructions to terminate QEMU, or used a wrapper
>         around QEMU which
>              sets breakpoints at exit (or _exit) and stops the simulator
>         when hit.
> 
>              If you are running Linux on QEMU, instead of using QEMU's
>         built-in gdb
>              interface you might use the Linux system as the target for
>         the test
>              suite, running gdbserver on the target.
> 
> 
>         I have finally managed to fully run QEMU with test suite but had
>         to make a local modification in the QEMU code itself.
>         In the translate function, I make a check if "bri 0" is reached
>         which is the '_exit'. Then, abort the QEMU app with the exit
>         code stored in 'r5'.
> 
> 
>     I've done essentially the same for other targets.
> 
>         Here are the results below:
>         _Without Patch:_
>         === gcc Summary ===
> 
>         # of expected passes90776
>         # of unexpected failures        1317
>         # of unexpected successes3
>         # of expected failures207
>         # of unresolved testcases115
>         # of unsupported tests2828
> 
>         _With Patch and after adding my test case:_
>         === gcc Summary ===
> 
>         # of expected passes90790
>         # of unexpected failures1317
>         # of unexpected successes3
>         # of expected failures207
>         # of unresolved testcases115
>         # of unsupported tests2828
> 
> 
>     This appears to be reasonable results.  It appears that there are no
>     regressions.
> 
>     Please send me the mb-gcc command line options for both of these
>     test runs.
> 
> 
> 
> 
>     -- 
>     Michael Eager eager@eagerm.com <mailto:eager@eagerm.com>
>     1960 Park Blvd., Palo Alto, CA 94306
> 
> 
> 
> 
> -- 
> 
> Andrew

-- 
Michael Eager    eager@eagerm.com
1960 Park Blvd., Palo Alto, CA 94306

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

* Re: [PATCH] [Microblaze]: PIC Data Text Relative
  2018-03-13  6:42               ` Michael Eager
@ 2018-03-13  7:56                 ` Andrew Sadek
  2018-03-13 20:51                   ` Michael Eager
  0 siblings, 1 reply; 27+ messages in thread
From: Andrew Sadek @ 2018-03-13  7:56 UTC (permalink / raw)
  To: Michael Eager; +Cc: gcc-patches

Ok, so you mean with '-fPIC -mpic-data-text-relative' as I do in my test
case ?
If all is Ok, execution and compilation shall ideally pass for the test
cases.
But I have noticed that there are some output pattern checks done in some
test cases and this may fail since the output assembly is different,
anyway I shall give it a try and send you the results with the new options.

On Tue, Mar 13, 2018 at 8:42 AM, Michael Eager <eager@eagerm.com> wrote:

> On 03/12/18 23:10, Andrew Sadek wrote:
>
>> _Command for running testsuite:_
>>
>> /make -k check-gcc RUNTESTFLAGS="-v --target_board=microblaze-qemu
>> CFLAGS_FOR_TARGET='-include /home/andrew/qemu/common.h
>> -L/home/andrew/qemu/lib -Wl,--start-group,-lxil,-lgcc,-lc,--end-group
>> -mlittle-endian' "/
>>
>> _Quick Details:_
>> 1) common.h: Here I define 'STACK_SIZE' with (0x4000) as it's used in
>> some test cases.
>> 2) -L ..... /lib: it contains libm, libc in little endian since we use
>> 'qemu-system-microblazeel', and libxil which is the libgloss + some
>> additional features (read, write, inbyte, outbyte) built with Xilinx SDK.
>>
>> _mb-gcc command example from gcc.log:_
>>
>> Testing execute/va-arg-15.c,   -O1
>> doing compile
>> Executing on host://home/andrew/gcc_workspace/gcc_orig/microblaze-xilinx-
>> elf/build/build-cc-gcc-final/gcc/xgcc -B/home/andrew/gcc_workspace/g
>> cc_orig/microblaze-xilinx-elf/build/build-cc-gcc-final/gcc/
>> /home/andrew/gcc_workspace/gcc_orig/microblaze-xilinx-elf/
>> src/gcc/gcc/testsuite/gcc.c-torture/execute/va-arg-15.c     -include
>> /home/andrew/qemu/common.h -L/home/andrew/qemu/lib
>> -Wl,--start-group,-lxil,-lgcc,-lc,--end-group -mlittle-endian
>> -fno-diagnostics-show-caret -fdiagnostics-color=never    -O1  -w
>> -T/home/andrew/qemu/qemu/microblazeel-softmmu/xilinx.ld  -lm  -o
>> ./va-arg-15.exe    (timeout = 300)/
>>
>
> OK.  This shows that the patch does not cause regressions when the new
> options are not used.  That is good.
>
> Please run the same regression test with the new PIC options.  Ideally you
> should have the same results.
>
>
>
>>
>>
>> On Mon, Mar 12, 2018 at 4:30 PM, Michael Eager <eager@eagerm.com <mailto:
>> eager@eagerm.com>> wrote:
>>
>>     On 03/12/18 06:19, Andrew Sadek wrote:
>>
>>
>>
>>         On Mon, Mar 5, 2018 at 9:21 PM, Michael Eager <eager@eagerm.com
>>         <mailto:eager@eagerm.com> <mailto:eager@eagerm.com
>>
>>         <mailto:eager@eagerm.com>>> wrote:
>>
>>              On 03/02/2018 08:12 AM, Andrew Sadek wrote:
>>
>>                  Hello Michael,
>>
>>                  I tried running the whole GCC test suite on the current
>>         head
>>                  (without my patch) along with 'microblaze-qemu' but I
>>         have the
>>                  following problems:
>>
>>                  1) The test is hanging at
>>         'gcc.c-torture/string-large-1.c' , the
>>                  gcc is making a 100% CPU usage and the machine stucks.
>>                  I tried compiling the file alone, it generated a couple
>> of
>>                  warnings than it hangs.
>>                     warning: '__builtin_memchr' specified size
>>         4294967295 exceeds
>>                  maximum object size 2147483647 [-Wstringop-overflow=]
>>                       vp1 = __builtin_memchr (a, b, SIZE1);
>>
>>                  Is it a bug? Is there something wrong with my
>>         configuration ?
>>                  GCC configured with options :  --with-newlib
>>         --enable-threads=no
>>                  --disable-shared --with-pkgversion='crosstool-NG
>>                  crosstool-ng-1.23.0-280-g01e3290' --enable-__cxa_atexit
>>                  --disable-libgomp --disable-libmudflap --disable-libmpx
>>                  --disable-libssp --disable-libquadmath
>>                  --disable-libquadmath-support --enable-lto
>>                  --with-host-libstdcxx='-static-libgcc
>>                  -Wl,-Bstatic,-lstdc++,-Bdynamic -lm'
>>         --enable-target-optspace
>>                  --disable-nls --enable-multiarch --enable-languages=c,c++
>>
>>
>>              Your configuration is more complex than my hard-metal
>>         target version,
>>              but it looks reasonable.
>>
>>              The problem with string-large-1.c does appear to be a bug.
>>        You can
>>              add a line to the test case which will mark it as known
>>         failure for MB:
>>
>>                 /* { dg-xfail-if "exceeds maximum" { microblaze-*-* } } */
>>
>>              (I have not tested this, but it should work.  Compare with
>>         other
>>              xfail's.)
>>
>>
>>         Problem that the whole compile package is invoked with '-w'
>>         which inhibits all warnings and overrides ' -Werror' as well as
>>         ' -Wfatal-errors' .
>>         As a result, the warning message does not appear when running
>>         compile.exp. Any suggestions ? Do I remove the '-w' ?
>>
>>
>>
>>                  2) For running QEMU, I have no problem with elf
>>         execution. But I
>>                  do not know how to auto terminate the QEMU itself  as
>>         it remains
>>                  up even after program execution.
>>                  Is there some command to be passed to QEMU in order
>>         make system
>>                  shut down after program termination with its exit code ?
>>
>>
>>              Yes, this is a problem.  For other targets using QEMU I
>>         have added dummy
>>              HLT instructions to terminate QEMU, or used a wrapper
>>         around QEMU which
>>              sets breakpoints at exit (or _exit) and stops the simulator
>>         when hit.
>>
>>              If you are running Linux on QEMU, instead of using QEMU's
>>         built-in gdb
>>              interface you might use the Linux system as the target for
>>         the test
>>              suite, running gdbserver on the target.
>>
>>
>>         I have finally managed to fully run QEMU with test suite but had
>>         to make a local modification in the QEMU code itself.
>>         In the translate function, I make a check if "bri 0" is reached
>>         which is the '_exit'. Then, abort the QE
>> <https://maps.google.com/?q=h+is+the+'_exit'.+Then,+abort+the+QE&entry=gmail&source=g>MU
>> app with the exit
>>         code stored in 'r5'.
>>
>>
>>     I've done essentially the same for
>> <https://maps.google.com/?q=I've+done+essentially+the+same+for+&entry=gmail&source=g>other
>> targets.
>>
>>         Here are the results below:
>>         _Without Patch:_
>>         === gcc Summary ===
>>
>>         # of expected passes90776
>>         # of unexpected failures        1317
>>         # of unexpected successes3
>>         # of expected failures207
>>         # of unresolved testcases115
>>         # of unsupported tests2828
>>
>>         _With Patch and after adding my test case:_
>>         === gcc Summary ===
>>
>>         # of expected passes90790
>>         # of unexpected failures1317
>>         # of unexpected successes3
>>         # of expected failures207
>>         # of unresolved testcases115
>>         # of unsupported tests2828
>>
>>
>>     This appears to be reasonable results.  It appears that there are no
>>     regressions.
>>
>>     Please send me the mb-gcc command line options for both of these
>>     test runs.
>>
>>
>>
>>
>>     --     Michael Eager eager@eagerm.com <mailto:eager@eagerm.com>
>>     1960 Park Blvd., Palo Alto, CA 94306
>>
>>
>>
>>
>> --
>>
>> Andrew
>>
>
> --
> Michael Eager    eager@eagerm.com
> 1960 Park Blvd., Palo Alto, CA 94306
>



-- 

Andrew

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

* Re: [PATCH] [Microblaze]: PIC Data Text Relative
  2018-03-13  7:56                 ` Andrew Sadek
@ 2018-03-13 20:51                   ` Michael Eager
       [not found]                     ` <CAE=jbAMCJ_8HR=ztOrY_FLfhYEMAFivyMO=Tz8EBdagd9zgs5g@mail.gmail.com>
  0 siblings, 1 reply; 27+ messages in thread
From: Michael Eager @ 2018-03-13 20:51 UTC (permalink / raw)
  To: Andrew Sadek; +Cc: gcc-patches

On 03/13/18 00:56, Andrew Sadek wrote:
> Ok, so you mean with '-fPIC -mpic-data-text-relative' as I do in my test 
> case ?
> If all is Ok, execution and compilation shall ideally pass for the test 
> cases.

Correct.

I want to make sure of two things:
   -- Your patch doesn't break anything (i.e., cause a regression) when
      you don't use the options.  This seems complete.
   -- Your patch works as intended when you do use the options.

> But I have noticed that there are some output pattern checks done in 
> some test cases and this may fail since the output assembly is different,
> anyway I shall give it a try and send you the results with the new options.

There should be no target dependencies in the generic GCC tests.
Different instruction patterns which generate the correct results should
not be a problem.

-- 
Michael Eager    eager@eagerm.com
1960 Park Blvd., Palo Alto, CA 94306

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

* Re: [PATCH] [Microblaze]: PIC Data Text Relative
       [not found]                     ` <CAE=jbAMCJ_8HR=ztOrY_FLfhYEMAFivyMO=Tz8EBdagd9zgs5g@mail.gmail.com>
@ 2018-03-18 14:56                       ` Andrew Sadek
  2018-03-19 20:09                         ` Michael Eager
  0 siblings, 1 reply; 27+ messages in thread
From: Andrew Sadek @ 2018-03-18 14:56 UTC (permalink / raw)
  To: Michael Eager; +Cc: gcc-patches

Hello Michael,

I have run the test using the new PIC options.
Actually, I have discovered 2 unhandled cases in 'microblaze_expand_move' +
missing conditions in linker relax
leading some test cases execution to fail.
After fixing them, I made a re-run for the whole regression, and the
results analogy below:

Original, without my patch:
        === gcc Summary ===

# of expected passes        90776
# of unexpected failures    1317
# of unexpected successes    3
# of expected failures        207
# of unresolved testcases    115
# of unsupported tests        2828

With my patch, calling '-fPIE - mpic-data-text-rel'
        === gcc Summary ===

# of expected passes        90843
# of unexpected failures    1256
# of unexpected successes    3
# of expected failures        207
# of unresolved testcases    115
# of unsupported tests        2853

After running the 'dg-cmp-results.sh' in contrib folder, the PASS->FAIL are
below:

PASS->FAIL: gcc.dg/uninit-19.c (test for excess errors)
PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O0   scan-assembler
lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O1   scan-assembler
lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
-fno-use-linker-plugin -flto-partition=none   scan-assembler
lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2   scan-assembler
lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O3 -g
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -Os   scan-assembler
lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O0   scan-assembler
lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O1   scan-assembler
lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
-fno-use-linker-plugin -flto-partition=none   scan-assembler
lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2   scan-assembler
lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O3 -g
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -Os   scan-assembler
lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O0
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O1
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
-fno-use-linker-plugin -flto-partition=none   scan-assembler
lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O3 -g
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -Os
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O0
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O1
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
-fno-use-linker-plugin -flto-partition=none   scan-assembler
lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O3 -g
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -Os
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O0
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O1
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
-fno-use-linker-plugin -flto-partition=none   scan-assembler
lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O3 -g
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -Os
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O0
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O1
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
-fno-use-linker-plugin -flto-partition=none   scan-assembler
lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O3 -g
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -Os
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O0
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O1
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2 -flto
-fno-use-linker-plugin -flto-partition=none   scan-assembler
lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O3 -g
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -Os
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O0
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O1
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2 -flto
-fno-use-linker-plugin -flto-partition=none   scan-assembler
lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O3 -g
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -Os
scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13

the 'gcc.dg/uninit-19.c ' already fails with -fPIE, and for the others in
microblaze,
expectation is r0 or r13 as a base register which is not the case here
'r20', and these tests also fails with -fPIE.
Moreover, the test cases that failed due 'unresolved GLOBAL_OFFSET_TABLE'
now pass as we do not have GOT in data text relative.

Please tell me if any adjustments needed or If I need to re-run nything.

Thanks

On Sun, Mar 18, 2018 at 12:25 PM, Andrew Sadek <andrew.sadek.se@gmail.com>
wrote:

> Hello Michael,
>
> I have run the test using the new PIC options.
> Actually, I have discovered 2 unhandled cases in 'microblaze_expand_move'
> + missing conditions in linker relax
> leading some test cases execution to fail.
> After fixing them, I made a re-run for the whole regression, and the
> results analogy below:
>
> Original, without my patch:
>         === gcc Summary ===
>
> # of expected passes        90776
> # of unexpected failures    1317
> # of unexpected successes    3
> # of expected failures        207
> # of unresolved testcases    115
> # of unsupported tests        2828
>
> With my patch, calling '-fPIE - mpic-data-text-rel'
>         === gcc Summary ===
>
> # of expected passes        90843
> # of unexpected failures    1256
> # of unexpected successes    3
> # of expected failures        207
> # of unresolved testcases    115
> # of unsupported tests        2853
>
> After running the 'dg-cmp-results.sh' in contrib folder, the PASS->FAIL
> are below:
>
> PASS->FAIL: gcc.dg/uninit-19.c (test for excess errors)
> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O0
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O1
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
> -fno-use-linker-plugin -flto-partition=none   scan-assembler
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O3 -g
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -Os
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O0
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O1
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
> -fno-use-linker-plugin -flto-partition=none   scan-assembler
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O3 -g
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -Os
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O0
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O1
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
> -fno-use-linker-plugin -flto-partition=none   scan-assembler
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O3 -g
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -Os
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O0
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O1
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
> -fno-use-linker-plugin -flto-partition=none   scan-assembler
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O3 -g
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -Os
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O0
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O1
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
> -fno-use-linker-plugin -flto-partition=none   scan-assembler
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O3 -g
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -Os
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O0
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O1
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
> -fno-use-linker-plugin -flto-partition=none   scan-assembler
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O3 -g
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -Os
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O0
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O1
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2 -flto
> -fno-use-linker-plugin -flto-partition=none   scan-assembler
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2 -flto
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O3 -g
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -Os
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O0
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O1
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2 -flto
> -fno-use-linker-plugin -flto-partition=none   scan-assembler
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2 -flto
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O3 -g
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -Os
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>
> the 'gcc.dg/uninit-19.c ' already fails with -fPIE, and for the others in
> microblaze,
> expectation is r0 or r13 as a base register which is not the case here
> 'r20', and these tests also fails with -fPIE.
> Moreover, the test cases that failed due 'unresolved GLOBAL_OFFSET_TABLE'
> now pass as we do not have GOT in data text relative.
>
> Attached the compare output of the scripit with verbosity 2.
> Please tell me if any adjustments needed or If I need to re-run nything.
>
> Thanks
>
>
> On Tue, Mar 13, 2018 at 10:44 PM, Michael Eager <eager@eagerm.com> wrote:
>
>> On 03/13/18 00:56, Andrew Sadek wrote:
>>
>>> Ok, so you mean with '-fPIC -mpic-data-text-relative' as I do in my test
>>> case ?
>>> If all is Ok, execution and compilation shall ideally pass for the test
>>> cases.
>>>
>>
>> Correct.
>>
>> I want to make sure of two things:
>>   -- Your patch doesn't break anything (i.e., cause a regression) when
>>      you don't use the options.  This seems complete.
>>   -- Your patch works as intended when you do use the options.
>>
>> But I have noticed that there are some output pattern checks done in some
>>> test cases and this may fail since the output assembly is different,
>>> anyway I shall give it a try and send you the results with the new
>>> options.
>>>
>>
>> There should be no target dependencies in the generic GCC tests.
>> Different instruction patterns which generate the correct results should
>> not be a problem.
>>
>>
>> --
>> Michael Eager    eager@eagerm.com
>> 1960 Park Blvd., Palo Alto, CA 94306
>>
>
>
>
> --
>
> Andrew
>



-- 

Andrew

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

* Re: [PATCH] [Microblaze]: PIC Data Text Relative
  2018-03-18 14:56                       ` Andrew Sadek
@ 2018-03-19 20:09                         ` Michael Eager
  2018-03-20  1:30                           ` Michael Eager
  0 siblings, 1 reply; 27+ messages in thread
From: Michael Eager @ 2018-03-19 20:09 UTC (permalink / raw)
  To: Andrew Sadek; +Cc: gcc-patches

Hi Andrew --

Good work.

Please submit your updated patch.  Check that you follow
GNU coding standards.  Also make sure that the new options
are documented in gcc/doc/invoke.texi.

On 03/18/18 03:27, Andrew Sadek wrote:
> Hello Michael,
> 
> I have run the test using the new PIC options.
> Actually, I have discovered 2 unhandled cases in 
> 'microblaze_expand_move' + missing conditions in linker relax
> leading some test cases execution to fail.
> After fixing them, I made a re-run for the whole regression, and the 
> results analogy below:
> 
> Original, without my patch:
>          === gcc Summary ===
> 
> # of expected passes        90776
> # of unexpected failures    1317
> # of unexpected successes    3
> # of expected failures        207
> # of unresolved testcases    115
> # of unsupported tests        2828
> 
> With my patch, calling '-fPIE - mpic-data-text-rel'
>          === gcc Summary ===
> 
> # of expected passes        90843
> # of unexpected failures    1256
> # of unexpected successes    3
> # of expected failures        207
> # of unresolved testcases    115
> # of unsupported tests        2853
> 
> After running the 'dg-cmp-results.sh' in contrib folder, the PASS->FAIL 
> are below:
> 
> PASS->FAIL: gcc.dg/uninit-19.c (test for excess errors)
> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O0   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O1   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler 
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler 
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O3 -g   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -Os   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O0   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O1   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler 
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler 
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O3 -g   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -Os   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O0   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O1   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler 
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler 
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O3 -g   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -Os   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O0   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O1   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler 
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler 
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O3 -g   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -Os   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O0   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O1   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler 
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler 
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O3 -g   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -Os   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O0   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O1   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler 
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler 
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O3 -g   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -Os   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O0   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O1   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler 
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler 
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O3 -g   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -Os   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O0   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O1   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2 -flto 
> -fno-use-linker-plugin -flto-partition=none   scan-assembler 
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2 -flto 
> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler 
> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O3 -g   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -Os   
> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> 
> the 'gcc.dg/uninit-19.c ' already fails with -fPIE, and for the others 
> in microblaze,
> expectation is r0 or r13 as a base register which is not the case here 
> 'r20', and these tests also fails with -fPIE.
> Moreover, the test cases that failed due 'unresolved 
> GLOBAL_OFFSET_TABLE' now pass as we do not have GOT in data text relative.
> 
> Please tell me if any adjustments needed or If I need to re-run nything.
> 
> Thanks
> 
> On Sun, Mar 18, 2018 at 12:25 PM, Andrew Sadek 
> <andrew.sadek.se@gmail.com <mailto:andrew.sadek.se@gmail.com>> wrote:
> 
>     Hello Michael,
> 
>     I have run the test using the new PIC options.
>     Actually, I have discovered 2 unhandled cases in
>     'microblaze_expand_move' + missing conditions in linker relax
>     leading some test cases execution to fail.
>     After fixing them, I made a re-run for the whole regression, and the
>     results analogy below:
> 
>     Original, without my patch:
>              === gcc Summary ===
> 
>     # of expected passes        90776
>     # of unexpected failures    1317
>     # of unexpected successes    3
>     # of expected failures        207
>     # of unresolved testcases    115
>     # of unsupported tests        2828
> 
>     With my patch, calling '-fPIE - mpic-data-text-rel'
>              === gcc Summary ===
> 
>     # of expected passes        90843
>     # of unexpected failures    1256
>     # of unexpected successes    3
>     # of expected failures        207
>     # of unresolved testcases    115
>     # of unsupported tests        2853
> 
>     After running the 'dg-cmp-results.sh' in contrib folder, the
>     PASS->FAIL are below:
> 
>     PASS->FAIL: gcc.dg/uninit-19.c (test for excess errors)
>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O0  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O1  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
>     -fno-use-linker-plugin -flto-partition=none   scan-assembler
>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
>     -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O3 -g  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -Os  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O0  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O1  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
>     -fno-use-linker-plugin -flto-partition=none   scan-assembler
>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
>     -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O3 -g  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -Os  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O0  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O1  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
>     -fno-use-linker-plugin -flto-partition=none   scan-assembler
>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
>     -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O3 -g  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -Os  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O0  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O1  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
>     -fno-use-linker-plugin -flto-partition=none   scan-assembler
>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
>     -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O3 -g  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -Os  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O0  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O1  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
>     -fno-use-linker-plugin -flto-partition=none   scan-assembler
>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
>     -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O3 -g  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -Os  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O0  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O1  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
>     -fno-use-linker-plugin -flto-partition=none   scan-assembler
>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
>     -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O3 -g  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -Os  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O0  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O1  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2
>     -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler
>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2
>     -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O3
>     -g   scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -Os  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O0  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O1  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2
>     -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler
>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2
>     -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O3
>     -g   scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -Os  
>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> 
>     the 'gcc.dg/uninit-19.c ' already fails with -fPIE, and for the
>     others in microblaze,
>     expectation is r0 or r13 as a base register which is not the case
>     here 'r20', and these tests also fails with -fPIE.
>     Moreover, the test cases that failed due 'unresolved
>     GLOBAL_OFFSET_TABLE' now pass as we do not have GOT in data text
>     relative.
> 
>     Attached the compare output of the scripit with verbosity 2.
>     Please tell me if any adjustments needed or If I need to re-run nything.
> 
>     Thanks
> 
> 
>     On Tue, Mar 13, 2018 at 10:44 PM, Michael Eager <eager@eagerm.com
>     <mailto:eager@eagerm.com>> wrote:
> 
>         On 03/13/18 00:56, Andrew Sadek wrote:
> 
>             Ok, so you mean with '-fPIC -mpic-data-text-relative' as I
>             do in my test case ?
>             If all is Ok, execution and compilation shall ideally pass
>             for the test cases.
> 
> 
>         Correct.
> 
>         I want to make sure of two things:
>            -- Your patch doesn't break anything (i.e., cause a
>         regression) when
>               you don't use the options.  This seems complete.
>            -- Your patch works as intended when you do use the options.
> 
>             But I have noticed that there are some output pattern checks
>             done in some test cases and this may fail since the output
>             assembly is different,
>             anyway I shall give it a try and send you the results with
>             the new options.
> 
> 
>         There should be no target dependencies in the generic GCC tests.
>         Different instruction patterns which generate the correct
>         results should
>         not be a problem.
> 
> 
>         -- 
>         Michael Eager eager@eagerm.com <mailto:eager@eagerm.com>
>         1960 Park Blvd., Palo Alto, CA 94306
> 
> 
> 
> 
>     -- 
> 
>     Andrew
> 
> 
> 
> 
> -- 
> 
> Andrew

-- 
Michael Eager    eager@eagerm.com
1960 Park Blvd., Palo Alto, CA 94306

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

* Re: [PATCH] [Microblaze]: PIC Data Text Relative
  2018-03-19 20:09                         ` Michael Eager
@ 2018-03-20  1:30                           ` Michael Eager
  2018-03-20  2:06                             ` Michael Eager
  0 siblings, 1 reply; 27+ messages in thread
From: Michael Eager @ 2018-03-20  1:30 UTC (permalink / raw)
  To: Andrew Sadek; +Cc: gcc-patches

Hi Andrew --

Please take a look at the test case description:
https://gcc.gnu.org/wiki/HowToPrepareATestcase
and see if you can do one of the following:
   - Modify the regex expression in the scan-assembler to accept
     either format of generated output
or
   - Add { dg-option } directives to turn off your new options
     if specified.  (You should be able to specify -mno-pic....)
or
   - Duplicate the test cases and add { dg-option } directives
     to specify the correct options, with and without your
     new options.
or
   - Add test cases with a { dg-option } directive with your
     new options.

This is not required -- your patch appears to work OK.  Normally,
the new PIC Data options would not be used when running the test
suite, so the tests would not fail.  It's just nice to have the
test suite updated when new options are added.

On 03/19/2018 01:07 PM, Michael Eager wrote:
> Hi Andrew --
> 
> Good work.
> 
> Please submit your updated patch.  Check that you follow
> GNU coding standards.  Also make sure that the new options
> are documented in gcc/doc/invoke.texi.
> 
> On 03/18/18 03:27, Andrew Sadek wrote:
>> Hello Michael,
>>
>> I have run the test using the new PIC options.
>> Actually, I have discovered 2 unhandled cases in 
>> 'microblaze_expand_move' + missing conditions in linker relax
>> leading some test cases execution to fail.
>> After fixing them, I made a re-run for the whole regression, and the 
>> results analogy below:
>>
>> Original, without my patch:
>>          === gcc Summary ===
>>
>> # of expected passes        90776
>> # of unexpected failures    1317
>> # of unexpected successes    3
>> # of expected failures        207
>> # of unresolved testcases    115
>> # of unsupported tests        2828
>>
>> With my patch, calling '-fPIE - mpic-data-text-rel'
>>          === gcc Summary ===
>>
>> # of expected passes        90843
>> # of unexpected failures    1256
>> # of unexpected successes    3
>> # of expected failures        207
>> # of unresolved testcases    115
>> # of unsupported tests        2853
>>
>> After running the 'dg-cmp-results.sh' in contrib folder, the 
>> PASS->FAIL are below:
>>
>> PASS->FAIL: gcc.dg/uninit-19.c (test for excess errors)
>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O0 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O1 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto 
>> -fno-use-linker-plugin -flto-partition=none   scan-assembler 
>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto 
>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler 
>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O3 -g 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -Os 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O0 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O1 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto 
>> -fno-use-linker-plugin -flto-partition=none   scan-assembler 
>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto 
>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler 
>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O3 -g 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -Os 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O0 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O1 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto 
>> -fno-use-linker-plugin -flto-partition=none   scan-assembler 
>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto 
>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler 
>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O3 -g 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -Os 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O0 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O1 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto 
>> -fno-use-linker-plugin -flto-partition=none   scan-assembler 
>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto 
>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler 
>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O3 -g 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -Os 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O0 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O1 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto 
>> -fno-use-linker-plugin -flto-partition=none   scan-assembler 
>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto 
>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler 
>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O3 -g 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -Os 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O0 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O1 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto 
>> -fno-use-linker-plugin -flto-partition=none   scan-assembler 
>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto 
>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler 
>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O3 -g 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -Os 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O0 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O1 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2 
>> -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler 
>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2 
>> -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler 
>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O3 -g 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -Os 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O0 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O1 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2 
>> -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler 
>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2 
>> -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler 
>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O3 -g 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -Os 
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>
>> the 'gcc.dg/uninit-19.c ' already fails with -fPIE, and for the others 
>> in microblaze,
>> expectation is r0 or r13 as a base register which is not the case here 
>> 'r20', and these tests also fails with -fPIE.
>> Moreover, the test cases that failed due 'unresolved 
>> GLOBAL_OFFSET_TABLE' now pass as we do not have GOT in data text 
>> relative.
>>
>> Please tell me if any adjustments needed or If I need to re-run nything.
>>
>> Thanks
>>
>> On Sun, Mar 18, 2018 at 12:25 PM, Andrew Sadek 
>> <andrew.sadek.se@gmail.com <mailto:andrew.sadek.se@gmail.com>> wrote:
>>
>>     Hello Michael,
>>
>>     I have run the test using the new PIC options.
>>     Actually, I have discovered 2 unhandled cases in
>>     'microblaze_expand_move' + missing conditions in linker relax
>>     leading some test cases execution to fail.
>>     After fixing them, I made a re-run for the whole regression, and the
>>     results analogy below:
>>
>>     Original, without my patch:
>>              === gcc Summary ===
>>
>>     # of expected passes        90776
>>     # of unexpected failures    1317
>>     # of unexpected successes    3
>>     # of expected failures        207
>>     # of unresolved testcases    115
>>     # of unsupported tests        2828
>>
>>     With my patch, calling '-fPIE - mpic-data-text-rel'
>>              === gcc Summary ===
>>
>>     # of expected passes        90843
>>     # of unexpected failures    1256
>>     # of unexpected successes    3
>>     # of expected failures        207
>>     # of unresolved testcases    115
>>     # of unsupported tests        2853
>>
>>     After running the 'dg-cmp-results.sh' in contrib folder, the
>>     PASS->FAIL are below:
>>
>>     PASS->FAIL: gcc.dg/uninit-19.c (test for excess errors)
>>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O0     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O1     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
>>     -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
>>     -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O3 -g     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -Os     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O0     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O1     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
>>     -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
>>     -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O3 -g     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -Os     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O0     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O1     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
>>     -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
>>     -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O3 -g     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -Os     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O0     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O1     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
>>     -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
>>     -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O3 -g     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -Os     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O0     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O1     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
>>     -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
>>     -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O3 -g     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -Os     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O0     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O1     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
>>     -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
>>     -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O3 -g     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -Os     
>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O0 
>>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O1 
>>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2
>>     -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2
>>     -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2 
>>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O3
>>     -g   scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -Os 
>>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O0 
>>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O1 
>>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2
>>     -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2
>>     -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2 
>>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O3
>>     -g   scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -Os 
>>     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>
>>     the 'gcc.dg/uninit-19.c ' already fails with -fPIE, and for the
>>     others in microblaze,
>>     expectation is r0 or r13 as a base register which is not the case
>>     here 'r20', and these tests also fails with -fPIE.
>>     Moreover, the test cases that failed due 'unresolved
>>     GLOBAL_OFFSET_TABLE' now pass as we do not have GOT in data text
>>     relative.
>>
>>     Attached the compare output of the scripit with verbosity 2.
>>     Please tell me if any adjustments needed or If I need to re-run 
>> nything.
>>
>>     Thanks
>>
>>
>>     On Tue, Mar 13, 2018 at 10:44 PM, Michael Eager <eager@eagerm.com
>>     <mailto:eager@eagerm.com>> wrote:
>>
>>         On 03/13/18 00:56, Andrew Sadek wrote:
>>
>>             Ok, so you mean with '-fPIC -mpic-data-text-relative' as I
>>             do in my test case ?
>>             If all is Ok, execution and compilation shall ideally pass
>>             for the test cases.
>>
>>
>>         Correct.
>>
>>         I want to make sure of two things:
>>            -- Your patch doesn't break anything (i.e., cause a
>>         regression) when
>>               you don't use the options.  This seems complete.
>>            -- Your patch works as intended when you do use the options.
>>
>>             But I have noticed that there are some output pattern checks
>>             done in some test cases and this may fail since the output
>>             assembly is different,
>>             anyway I shall give it a try and send you the results with
>>             the new options.
>>
>>
>>         There should be no target dependencies in the generic GCC tests.
>>         Different instruction patterns which generate the correct
>>         results should
>>         not be a problem.
>>
>>
>>         --         Michael Eager eager@eagerm.com 
>> <mailto:eager@eagerm.com>
>>         1960 Park Blvd., Palo Alto, CA 94306
>>
>>
>>
>>
>>     --
>>     Andrew
>>
>>
>>
>>
>> -- 
>>
>> Andrew
> 

-- 
Michael Eager    eager@eagerm.com
1960 Park Blvd., Palo Alto, CA 94306

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

* Re: [PATCH] [Microblaze]: PIC Data Text Relative
  2018-03-20  1:30                           ` Michael Eager
@ 2018-03-20  2:06                             ` Michael Eager
  2018-03-20 14:18                               ` Andrew Sadek
  0 siblings, 1 reply; 27+ messages in thread
From: Michael Eager @ 2018-03-20  2:06 UTC (permalink / raw)
  To: Andrew Sadek; +Cc: gcc-patches

Also check the { dg-skip-if } directive.
https://gcc.gnu.org/onlinedocs/gccint/Directives.html

On 03/19/2018 06:14 PM, Michael Eager wrote:
> Hi Andrew --
> 
> Please take a look at the test case description:
> https://gcc.gnu.org/wiki/HowToPrepareATestcase
> and see if you can do one of the following:
>    - Modify the regex expression in the scan-assembler to accept
>      either format of generated output
> or
>    - Add { dg-option } directives to turn off your new options
>      if specified.  (You should be able to specify -mno-pic....)
> or
>    - Duplicate the test cases and add { dg-option } directives
>      to specify the correct options, with and without your
>      new options.
> or
>    - Add test cases with a { dg-option } directive with your
>      new options.
> 
> This is not required -- your patch appears to work OK.  Normally,
> the new PIC Data options would not be used when running the test
> suite, so the tests would not fail.  It's just nice to have the
> test suite updated when new options are added.
> 
> On 03/19/2018 01:07 PM, Michael Eager wrote:
>> Hi Andrew --
>>
>> Good work.
>>
>> Please submit your updated patch.  Check that you follow
>> GNU coding standards.  Also make sure that the new options
>> are documented in gcc/doc/invoke.texi.
>>
>> On 03/18/18 03:27, Andrew Sadek wrote:
>>> Hello Michael,
>>>
>>> I have run the test using the new PIC options.
>>> Actually, I have discovered 2 unhandled cases in 
>>> 'microblaze_expand_move' + missing conditions in linker relax
>>> leading some test cases execution to fail.
>>> After fixing them, I made a re-run for the whole regression, and the 
>>> results analogy below:
>>>
>>> Original, without my patch:
>>>          === gcc Summary ===
>>>
>>> # of expected passes        90776
>>> # of unexpected failures    1317
>>> # of unexpected successes    3
>>> # of expected failures        207
>>> # of unresolved testcases    115
>>> # of unsupported tests        2828
>>>
>>> With my patch, calling '-fPIE - mpic-data-text-rel'
>>>          === gcc Summary ===
>>>
>>> # of expected passes        90843
>>> # of unexpected failures    1256
>>> # of unexpected successes    3
>>> # of expected failures        207
>>> # of unresolved testcases    115
>>> # of unsupported tests        2853
>>>
>>> After running the 'dg-cmp-results.sh' in contrib folder, the 
>>> PASS->FAIL are below:
>>>
>>> PASS->FAIL: gcc.dg/uninit-19.c (test for excess errors)
>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O0 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O1 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto 
>>> -fno-use-linker-plugin -flto-partition=none   scan-assembler 
>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto 
>>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler 
>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O3 -g 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -Os 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O0 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O1 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto 
>>> -fno-use-linker-plugin -flto-partition=none   scan-assembler 
>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto 
>>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler 
>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O3 -g 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -Os 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O0 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O1 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto 
>>> -fno-use-linker-plugin -flto-partition=none   scan-assembler 
>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto 
>>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler 
>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O3 -g 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -Os 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O0 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O1 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto 
>>> -fno-use-linker-plugin -flto-partition=none   scan-assembler 
>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto 
>>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler 
>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O3 -g 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -Os 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O0 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O1 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto 
>>> -fno-use-linker-plugin -flto-partition=none   scan-assembler 
>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto 
>>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler 
>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O3 -g 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -Os 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O0 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O1 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto 
>>> -fno-use-linker-plugin -flto-partition=none   scan-assembler 
>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto 
>>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler 
>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O3 -g 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -Os 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O0 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O1 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2 
>>> -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler 
>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2 
>>> -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler 
>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O3 -g 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -Os 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O0 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O1 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2 
>>> -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler 
>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2 
>>> -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler 
>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O3 -g 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -Os 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>
>>> the 'gcc.dg/uninit-19.c ' already fails with -fPIE, and for the 
>>> others in microblaze,
>>> expectation is r0 or r13 as a base register which is not the case 
>>> here 'r20', and these tests also fails with -fPIE.
>>> Moreover, the test cases that failed due 'unresolved 
>>> GLOBAL_OFFSET_TABLE' now pass as we do not have GOT in data text 
>>> relative.
>>>
>>> Please tell me if any adjustments needed or If I need to re-run nything.
>>>
>>> Thanks
>>>
>>> On Sun, Mar 18, 2018 at 12:25 PM, Andrew Sadek 
>>> <andrew.sadek.se@gmail.com <mailto:andrew.sadek.se@gmail.com>> wrote:
>>>
>>>     Hello Michael,
>>>
>>>     I have run the test using the new PIC options.
>>>     Actually, I have discovered 2 unhandled cases in
>>>     'microblaze_expand_move' + missing conditions in linker relax
>>>     leading some test cases execution to fail.
>>>     After fixing them, I made a re-run for the whole regression, and the
>>>     results analogy below:
>>>
>>>     Original, without my patch:
>>>              === gcc Summary ===
>>>
>>>     # of expected passes        90776
>>>     # of unexpected failures    1317
>>>     # of unexpected successes    3
>>>     # of expected failures        207
>>>     # of unresolved testcases    115
>>>     # of unsupported tests        2828
>>>
>>>     With my patch, calling '-fPIE - mpic-data-text-rel'
>>>              === gcc Summary ===
>>>
>>>     # of expected passes        90843
>>>     # of unexpected failures    1256
>>>     # of unexpected successes    3
>>>     # of expected failures        207
>>>     # of unresolved testcases    115
>>>     # of unsupported tests        2853
>>>
>>>     After running the 'dg-cmp-results.sh' in contrib folder, the
>>>     PASS->FAIL are below:
>>>
>>>     PASS->FAIL: gcc.dg/uninit-19.c (test for excess errors)
>>>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O0 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O1 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
>>>     -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
>>>     -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O3 -g 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -Os 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O0 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O1 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
>>>     -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
>>>     -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O3 -g 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -Os 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O0 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O1 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
>>>     -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
>>>     -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O3 -g 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -Os 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O0 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O1 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
>>>     -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
>>>     -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O3 -g 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -Os 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O0 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O1 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
>>>     -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
>>>     -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O3 -g 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -Os 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O0 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O1 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
>>>     -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
>>>     -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O3 -g 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -Os 
>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   
>>> -O0     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   
>>> -O1     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2
>>>     -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2
>>>     -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   
>>> -O2     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O3
>>>     -g   scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   
>>> -Os     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   
>>> -O0     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   
>>> -O1     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2
>>>     -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2
>>>     -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   
>>> -O2     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O3
>>>     -g   scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   
>>> -Os     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>
>>>     the 'gcc.dg/uninit-19.c ' already fails with -fPIE, and for the
>>>     others in microblaze,
>>>     expectation is r0 or r13 as a base register which is not the case
>>>     here 'r20', and these tests also fails with -fPIE.
>>>     Moreover, the test cases that failed due 'unresolved
>>>     GLOBAL_OFFSET_TABLE' now pass as we do not have GOT in data text
>>>     relative.
>>>
>>>     Attached the compare output of the scripit with verbosity 2.
>>>     Please tell me if any adjustments needed or If I need to re-run 
>>> nything.
>>>
>>>     Thanks
>>>
>>>
>>>     On Tue, Mar 13, 2018 at 10:44 PM, Michael Eager <eager@eagerm.com
>>>     <mailto:eager@eagerm.com>> wrote:
>>>
>>>         On 03/13/18 00:56, Andrew Sadek wrote:
>>>
>>>             Ok, so you mean with '-fPIC -mpic-data-text-relative' as I
>>>             do in my test case ?
>>>             If all is Ok, execution and compilation shall ideally pass
>>>             for the test cases.
>>>
>>>
>>>         Correct.
>>>
>>>         I want to make sure of two things:
>>>            -- Your patch doesn't break anything (i.e., cause a
>>>         regression) when
>>>               you don't use the options.  This seems complete.
>>>            -- Your patch works as intended when you do use the options.
>>>
>>>             But I have noticed that there are some output pattern checks
>>>             done in some test cases and this may fail since the output
>>>             assembly is different,
>>>             anyway I shall give it a try and send you the results with
>>>             the new options.
>>>
>>>
>>>         There should be no target dependencies in the generic GCC tests.
>>>         Different instruction patterns which generate the correct
>>>         results should
>>>         not be a problem.
>>>
>>>
>>>         --         Michael Eager eager@eagerm.com 
>>> <mailto:eager@eagerm.com>
>>>         1960 Park Blvd., Palo Alto, CA 94306
>>>
>>>
>>>
>>>
>>>     --
>>>     Andrew
>>>
>>>
>>>
>>>
>>> -- 
>>>
>>> Andrew
>>
> 

-- 
Michael Eager    eager@eagerm.com
1960 Park Blvd., Palo Alto, CA 94306

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

* Re: [PATCH] [Microblaze]: PIC Data Text Relative
  2018-03-20  2:06                             ` Michael Eager
@ 2018-03-20 14:18                               ` Andrew Sadek
  2018-03-20 15:49                                 ` Michael Eager
  0 siblings, 1 reply; 27+ messages in thread
From: Andrew Sadek @ 2018-03-20 14:18 UTC (permalink / raw)
  To: Michael Eager; +Cc: gcc-patches

Many Thanks Michael for the updates .. I was actually looking for something
similar for my test case .. I m currently revising the Gnu code conventions
on the patches then will send them again.
I m actually running the 'check_GNU_Style' in contrib folder,, is this the
correct way ? Is it enough ?

Andrew

On Tue, Mar 20, 2018, 03:30 Michael Eager <eager@eagerm.com> wrote:

> Also check the { dg-skip-if } directive.
> https://gcc.gnu.org/onlinedocs/gccint/Directives.html
>
> On 03/19/2018 06:14 PM, Michael Eager wrote:
> > Hi Andrew --
> >
> > Please take a look at the test case description:
> > https://gcc.gnu.org/wiki/HowToPrepareATestcase
> > and see if you can do one of the following:
> >    - Modify the regex expression in the scan-assembler to accept
> >      either format of generated output
> > or
> >    - Add { dg-option } directives to turn off your new options
> >      if specified.  (You should be able to specify -mno-pic....)
> > or
> >    - Duplicate the test cases and add { dg-option } directives
> >      to specify the correct options, with and without your
> >      new options.
> > or
> >    - Add test cases with a { dg-option } directive with your
> >      new options.
> >
> > This is not required -- your patch appears to work OK.  Normally,
> > the new PIC Data options would not be used when running the test
> > suite, so the tests would not fail.  It's just nice to have the
> > test suite updated when new options are added.
> >
> > On 03/19/2018 01:07 PM, Michael Eager wrote:
> >> Hi Andrew --
> >>
> >> Good work.
> >>
> >> Please submit your updated patch.  Check that you follow
> >> GNU coding standards.  Also make sure that the new options
> >> are documented in gcc/doc/invoke.texi.
> >>
> >> On 03/18/18 03:27, Andrew Sadek wrote:
> >>> Hello Michael,
> >>>
> >>> I have run the test using the new PIC options.
> >>> Actually, I have discovered 2 unhandled cases in
> >>> 'microblaze_expand_move' + missing conditions in linker relax
> >>> leading some test cases execution to fail.
> >>> After fixing them, I made a re-run for the whole regression, and the
> >>> results analogy below:
> >>>
> >>> Original, without my patch:
> >>>          === gcc Summary ===
> >>>
> >>> # of expected passes        90776
> >>> # of unexpected failures    1317
> >>> # of unexpected successes    3
> >>> # of expected failures        207
> >>> # of unresolved testcases    115
> >>> # of unsupported tests        2828
> >>>
> >>> With my patch, calling '-fPIE - mpic-data-text-rel'
> >>>          === gcc Summary ===
> >>>
> >>> # of expected passes        90843
> >>> # of unexpected failures    1256
> >>> # of unexpected successes    3
> >>> # of expected failures        207
> >>> # of unresolved testcases    115
> >>> # of unsupported tests        2853
> >>>
> >>> After running the 'dg-cmp-results.sh' in contrib folder, the
> >>> PASS->FAIL are below:
> >>>
> >>> PASS->FAIL: gcc.dg/uninit-19.c (test for excess errors)
> >>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O0
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O1
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
> >>> -fno-use-linker-plugin -flto-partition=none   scan-assembler
> >>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
> >>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
> >>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O3 -g
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -Os
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O0
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O1
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
> >>> -fno-use-linker-plugin -flto-partition=none   scan-assembler
> >>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
> >>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
> >>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O3 -g
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -Os
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O0
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O1
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
> >>> -fno-use-linker-plugin -flto-partition=none   scan-assembler
> >>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
> >>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
> >>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O3 -g
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -Os
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O0
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O1
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
> >>> -fno-use-linker-plugin -flto-partition=none   scan-assembler
> >>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
> >>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
> >>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O3 -g
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -Os
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O0
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O1
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
> >>> -fno-use-linker-plugin -flto-partition=none   scan-assembler
> >>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
> >>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
> >>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O3 -g
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -Os
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O0
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O1
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
> >>> -fno-use-linker-plugin -flto-partition=none   scan-assembler
> >>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
> >>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
> >>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O3 -g
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -Os
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O0
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O1
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2
> >>> -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler
> >>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2
> >>> -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
> >>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O3 -g
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -Os
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O0
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O1
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2
> >>> -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler
> >>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2
> >>> -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
> >>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O3 -g
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -Os
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>
> >>> the 'gcc.dg/uninit-19.c ' already fails with -fPIE, and for the
> >>> others in microblaze,
> >>> expectation is r0 or r13 as a base register which is not the case
> >>> here 'r20', and these tests also fails with -fPIE.
> >>> Moreover, the test cases that failed due 'unresolved
> >>> GLOBAL_OFFSET_TABLE' now pass as we do not have GOT in data text
> >>> relative.
> >>>
> >>> Please tell me if any adjustments needed or If I need to re-run
> nything.
> >>>
> >>> Thanks
> >>>
> >>> On Sun, Mar 18, 2018 at 12:25 PM, Andrew Sadek
> >>> <andrew.sadek.se@gmail.com <mailto:andrew.sadek.se@gmail.com>> wrote:
> >>>
> >>>     Hello Michael,
> >>>
> >>>     I have run the test using the new PIC options.
> >>>     Actually, I have discovered 2 unhandled cases in
> >>>     'microblaze_expand_move' + missing conditions in linker relax
> >>>     leading some test cases execution to fail.
> >>>     After fixing them, I made a re-run for the whole regression, and
> the
> >>>     results analogy below:
> >>>
> >>>     Original, without my patch:
> >>>              === gcc Summary ===
> >>>
> >>>     # of expected passes        90776
> >>>     # of unexpected failures    1317
> >>>     # of unexpected successes    3
> >>>     # of expected failures        207
> >>>     # of unresolved testcases    115
> >>>     # of unsupported tests        2828
> >>>
> >>>     With my patch, calling '-fPIE - mpic-data-text-rel'
> >>>              === gcc Summary ===
> >>>
> >>>     # of expected passes        90843
> >>>     # of unexpected failures    1256
> >>>     # of unexpected successes    3
> >>>     # of expected failures        207
> >>>     # of unresolved testcases    115
> >>>     # of unsupported tests        2853
> >>>
> >>>     After running the 'dg-cmp-results.sh' in contrib folder, the
> >>>     PASS->FAIL are below:
> >>>
> >>>     PASS->FAIL: gcc.dg/uninit-19.c (test for excess errors)
> >>>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O0
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O1
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
> >>>     -fno-use-linker-plugin -flto-partition=none   scan-assembler
> >>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
> >>>     -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
> >>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O3 -g
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>>     PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -Os
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O0
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O1
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
> >>>     -fno-use-linker-plugin -flto-partition=none   scan-assembler
> >>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
> >>>     -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
> >>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O3 -g
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>>     PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -Os
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O0
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O1
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
> >>>     -fno-use-linker-plugin -flto-partition=none   scan-assembler
> >>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
> >>>     -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
> >>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O3 -g
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -Os
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O0
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O1
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
> >>>     -fno-use-linker-plugin -flto-partition=none   scan-assembler
> >>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
> >>>     -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
> >>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O3 -g
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -Os
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O0
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O1
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
> >>>     -fno-use-linker-plugin -flto-partition=none   scan-assembler
> >>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
> >>>     -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
> >>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O3 -g
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -Os
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O0
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O1
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
> >>>     -fno-use-linker-plugin -flto-partition=none   scan-assembler
> >>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
> >>>     -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
> >>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O3 -g
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -Os
> >>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c
> >>> -O0     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c
> >>> -O1     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2
> >>>     -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler
> >>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2
> >>>     -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
> >>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c
> >>> -O2     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O3
> >>>     -g   scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c
> >>> -Os     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c
> >>> -O0     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c
> >>> -O1     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2
> >>>     -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler
> >>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2
> >>>     -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
> >>>     lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c
> >>> -O2     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O3
> >>>     -g   scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>     PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c
> >>> -Os     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
> >>>
> >>>     the 'gcc.dg/uninit-19.c ' already fails with -fPIE, and for the
> >>>     others in microblaze,
> >>>     expectation is r0 or r13 as a base register which is not the case
> >>>     here 'r20', and these tests also fails with -fPIE.
> >>>     Moreover, the test cases that failed due 'unresolved
> >>>     GLOBAL_OFFSET_TABLE' now pass as we do not have GOT in data text
> >>>     relative.
> >>>
> >>>     Attached the compare output of the scripit with verbosity 2.
> >>>     Please tell me if any adjustments needed or If I need to re-run
> >>> nything.
> >>>
> >>>     Thanks
> >>>
> >>>
> >>>     On Tue, Mar 13, 2018 at 10:44 PM, Michael Eager <eager@eagerm.com
> >>>     <mailto:eager@eagerm.com>> wrote:
> >>>
> >>>         On 03/13/18 00:56, Andrew Sadek wrote:
> >>>
> >>>             Ok, so you mean with '-fPIC -mpic-data-text-relative' as I
> >>>             do in my test case ?
> >>>             If all is Ok, execution and compilation shall ideally pass
> >>>             for the test cases.
> >>>
> >>>
> >>>         Correct.
> >>>
> >>>         I want to make sure of two things:
> >>>            -- Your patch doesn't break anything (i.e., cause a
> >>>         regression) when
> >>>               you don't use the options.  This seems complete.
> >>>            -- Your patch works as intended when you do use the options.
> >>>
> >>>             But I have noticed that there are some output pattern
> checks
> >>>             done in some test cases and this may fail since the output
> >>>             assembly is different,
> >>>             anyway I shall give it a try and send you the results with
> >>>             the new options.
> >>>
> >>>
> >>>         There should be no target dependencies in the generic GCC
> tests.
> >>>         Different instruction patterns which generate the correct
> >>>         results should
> >>>         not be a problem.
> >>>
> >>>
> >>>         --         Michael Eager eager@eagerm.com
> >>> <mailto:eager@eagerm.com>
> >>>         1960 Park Blvd., Palo Alto, CA 94306
> >>>
> >>>
> >>>
> >>>
> >>>     --
> >>>     Andrew
> >>>
> >>>
> >>>
> >>>
> >>> --
> >>>
> >>> Andrew
> >>
> >
>
> --
> Michael Eager    eager@eagerm.com
> 1960 Park Blvd., Palo Alto, CA 94306
>

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

* Re: [PATCH] [Microblaze]: PIC Data Text Relative
  2018-03-20 14:18                               ` Andrew Sadek
@ 2018-03-20 15:49                                 ` Michael Eager
  2018-03-22 18:45                                   ` Andrew Sadek
  0 siblings, 1 reply; 27+ messages in thread
From: Michael Eager @ 2018-03-20 15:49 UTC (permalink / raw)
  To: Andrew Sadek; +Cc: gcc-patches

Hi Andrew --

I just do a visual check.  The script can help.

On 03/20/2018 07:13 AM, Andrew Sadek wrote:
> Many Thanks Michael for the updates .. I was actually looking for something
> similar for my test case .. I m currently revising the Gnu code conventions
> on the patches then will send them again.
> I m actually running the 'check_GNU_Style' in contrib folder,, is this the
> correct way ? Is it enough ?
> 
> Andrew
> 
> On Tue, Mar 20, 2018, 03:30 Michael Eager <eager@eagerm.com> wrote:
> 
>> Also check the { dg-skip-if } directive.
>> https://gcc.gnu.org/onlinedocs/gccint/Directives.html
>>
>> On 03/19/2018 06:14 PM, Michael Eager wrote:
>>> Hi Andrew --
>>>
>>> Please take a look at the test case description:
>>> https://gcc.gnu.org/wiki/HowToPrepareATestcase
>>> and see if you can do one of the following:
>>>     - Modify the regex expression in the scan-assembler to accept
>>>       either format of generated output
>>> or
>>>     - Add { dg-option } directives to turn off your new options
>>>       if specified.  (You should be able to specify -mno-pic....)
>>> or
>>>     - Duplicate the test cases and add { dg-option } directives
>>>       to specify the correct options, with and without your
>>>       new options.
>>> or
>>>     - Add test cases with a { dg-option } directive with your
>>>       new options.
>>>
>>> This is not required -- your patch appears to work OK.  Normally,
>>> the new PIC Data options would not be used when running the test
>>> suite, so the tests would not fail.  It's just nice to have the
>>> test suite updated when new options are added.
>>>
>>> On 03/19/2018 01:07 PM, Michael Eager wrote:
>>>> Hi Andrew --
>>>>
>>>> Good work.
>>>>
>>>> Please submit your updated patch.  Check that you follow
>>>> GNU coding standards.  Also make sure that the new options
>>>> are documented in gcc/doc/invoke.texi.
>>>>
>>>> On 03/18/18 03:27, Andrew Sadek wrote:
>>>>> Hello Michael,
>>>>>
>>>>> I have run the test using the new PIC options.
>>>>> Actually, I have discovered 2 unhandled cases in
>>>>> 'microblaze_expand_move' + missing conditions in linker relax
>>>>> leading some test cases execution to fail.
>>>>> After fixing them, I made a re-run for the whole regression, and the
>>>>> results analogy below:
>>>>>
>>>>> Original, without my patch:
>>>>>           === gcc Summary ===
>>>>>
>>>>> # of expected passes        90776
>>>>> # of unexpected failures    1317
>>>>> # of unexpected successes    3
>>>>> # of expected failures        207
>>>>> # of unresolved testcases    115
>>>>> # of unsupported tests        2828
>>>>>
>>>>> With my patch, calling '-fPIE - mpic-data-text-rel'
>>>>>           === gcc Summary ===
>>>>>
>>>>> # of expected passes        90843
>>>>> # of unexpected failures    1256
>>>>> # of unexpected successes    3
>>>>> # of expected failures        207
>>>>> # of unresolved testcases    115
>>>>> # of unsupported tests        2853
>>>>>
>>>>> After running the 'dg-cmp-results.sh' in contrib folder, the
>>>>> PASS->FAIL are below:
>>>>>
>>>>> PASS->FAIL: gcc.dg/uninit-19.c (test for excess errors)
>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O0
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O1
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
>>>>> -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
>>>>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O3 -g
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -Os
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O0
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O1
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
>>>>> -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
>>>>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O3 -g
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -Os
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O0
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O1
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
>>>>> -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
>>>>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O3 -g
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -Os
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O0
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O1
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
>>>>> -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
>>>>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O3 -g
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -Os
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O0
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O1
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
>>>>> -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
>>>>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O3 -g
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -Os
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O0
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O1
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
>>>>> -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
>>>>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O3 -g
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -Os
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O0
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O1
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2
>>>>> -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2
>>>>> -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O3 -g
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -Os
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O0
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O1
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2
>>>>> -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2
>>>>> -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O3 -g
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -Os
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>
>>>>> the 'gcc.dg/uninit-19.c ' already fails with -fPIE, and for the
>>>>> others in microblaze,
>>>>> expectation is r0 or r13 as a base register which is not the case
>>>>> here 'r20', and these tests also fails with -fPIE.
>>>>> Moreover, the test cases that failed due 'unresolved
>>>>> GLOBAL_OFFSET_TABLE' now pass as we do not have GOT in data text
>>>>> relative.
>>>>>
>>>>> Please tell me if any adjustments needed or If I need to re-run
>> nything.
>>>>>
>>>>> Thanks
>>>>>
>>>>> On Sun, Mar 18, 2018 at 12:25 PM, Andrew Sadek
>>>>> <andrew.sadek.se@gmail.com <mailto:andrew.sadek.se@gmail.com>> wrote:
>>>>>
>>>>>      Hello Michael,
>>>>>
>>>>>      I have run the test using the new PIC options.
>>>>>      Actually, I have discovered 2 unhandled cases in
>>>>>      'microblaze_expand_move' + missing conditions in linker relax
>>>>>      leading some test cases execution to fail.
>>>>>      After fixing them, I made a re-run for the whole regression, and
>> the
>>>>>      results analogy below:
>>>>>
>>>>>      Original, without my patch:
>>>>>               === gcc Summary ===
>>>>>
>>>>>      # of expected passes        90776
>>>>>      # of unexpected failures    1317
>>>>>      # of unexpected successes    3
>>>>>      # of expected failures        207
>>>>>      # of unresolved testcases    115
>>>>>      # of unsupported tests        2828
>>>>>
>>>>>      With my patch, calling '-fPIE - mpic-data-text-rel'
>>>>>               === gcc Summary ===
>>>>>
>>>>>      # of expected passes        90843
>>>>>      # of unexpected failures    1256
>>>>>      # of unexpected successes    3
>>>>>      # of expected failures        207
>>>>>      # of unresolved testcases    115
>>>>>      # of unsupported tests        2853
>>>>>
>>>>>      After running the 'dg-cmp-results.sh' in contrib folder, the
>>>>>      PASS->FAIL are below:
>>>>>
>>>>>      PASS->FAIL: gcc.dg/uninit-19.c (test for excess errors)
>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O0
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O1
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
>>>>>      -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
>>>>>      -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O3 -g
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -Os
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O0
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O1
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
>>>>>      -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
>>>>>      -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O3 -g
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -Os
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O0
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O1
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
>>>>>      -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
>>>>>      -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O3 -g
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -Os
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O0
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O1
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
>>>>>      -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
>>>>>      -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O3 -g
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -Os
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O0
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O1
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
>>>>>      -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
>>>>>      -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O3 -g
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -Os
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O0
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O1
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
>>>>>      -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
>>>>>      -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O3 -g
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -Os
>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c
>>>>> -O0     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c
>>>>> -O1     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2
>>>>>      -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2
>>>>>      -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c
>>>>> -O2     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O3
>>>>>      -g   scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c
>>>>> -Os     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c
>>>>> -O0     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c
>>>>> -O1     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2
>>>>>      -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2
>>>>>      -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c
>>>>> -O2     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O3
>>>>>      -g   scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c
>>>>> -Os     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>
>>>>>      the 'gcc.dg/uninit-19.c ' already fails with -fPIE, and for the
>>>>>      others in microblaze,
>>>>>      expectation is r0 or r13 as a base register which is not the case
>>>>>      here 'r20', and these tests also fails with -fPIE.
>>>>>      Moreover, the test cases that failed due 'unresolved
>>>>>      GLOBAL_OFFSET_TABLE' now pass as we do not have GOT in data text
>>>>>      relative.
>>>>>
>>>>>      Attached the compare output of the scripit with verbosity 2.
>>>>>      Please tell me if any adjustments needed or If I need to re-run
>>>>> nything.
>>>>>
>>>>>      Thanks
>>>>>
>>>>>
>>>>>      On Tue, Mar 13, 2018 at 10:44 PM, Michael Eager <eager@eagerm.com
>>>>>      <mailto:eager@eagerm.com>> wrote:
>>>>>
>>>>>          On 03/13/18 00:56, Andrew Sadek wrote:
>>>>>
>>>>>              Ok, so you mean with '-fPIC -mpic-data-text-relative' as I
>>>>>              do in my test case ?
>>>>>              If all is Ok, execution and compilation shall ideally pass
>>>>>              for the test cases.
>>>>>
>>>>>
>>>>>          Correct.
>>>>>
>>>>>          I want to make sure of two things:
>>>>>             -- Your patch doesn't break anything (i.e., cause a
>>>>>          regression) when
>>>>>                you don't use the options.  This seems complete.
>>>>>             -- Your patch works as intended when you do use the options.
>>>>>
>>>>>              But I have noticed that there are some output pattern
>> checks
>>>>>              done in some test cases and this may fail since the output
>>>>>              assembly is different,
>>>>>              anyway I shall give it a try and send you the results with
>>>>>              the new options.
>>>>>
>>>>>
>>>>>          There should be no target dependencies in the generic GCC
>> tests.
>>>>>          Different instruction patterns which generate the correct
>>>>>          results should
>>>>>          not be a problem.
>>>>>
>>>>>
>>>>>          --         Michael Eager eager@eagerm.com
>>>>> <mailto:eager@eagerm.com>
>>>>>          1960 Park Blvd., Palo Alto, CA 94306
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>      --
>>>>>      Andrew
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> Andrew
>>>>
>>>
>>
>> --
>> Michael Eager    eager@eagerm.com
>> 1960 Park Blvd., Palo Alto, CA 94306
>>
> 

-- 
Michael Eager    eager@eagerm.com
1960 Park Blvd., Palo Alto, CA 94306

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

* Re: [PATCH] [Microblaze]: PIC Data Text Relative
  2018-03-20 15:49                                 ` Michael Eager
@ 2018-03-22 18:45                                   ` Andrew Sadek
  2018-04-18 12:44                                     ` Andrew Sadek
  0 siblings, 1 reply; 27+ messages in thread
From: Andrew Sadek @ 2018-03-22 18:45 UTC (permalink / raw)
  To: Michael Eager; +Cc: gcc-patches, nmekala

Hello Michael,

I have adapted the test cases.

Please find the patch below with Change log, description and test results.

Description:
------------------

This branch is regarding a new implemented feature in GCC Microblaze
that allows Position Independent Code to run using Data Text Relative
addressing instead of using Global Offset Table.

Its aim was to make 'PIC' more efficient and flexible as elf size
excess/ performance overhead were noticed when using GOT due to the
indirect addressing.
The change was tested with the dhrystone benchmark on a real Hardware
(Xilinx FPGA Spartan 6) and the test report went successfully for all
optimization levels.

Indeed, Microblaze does not support PC-relative addressing in Hardware like ARM.
The idea was to store the start address of current text section in
'r20' instead of GOT, in the function prologue. Correspondingly, data
references will be an offset from the original reference value to the
start of text thus being added to the 'r20' base register will resolve
the actual address.

Henceforth, 2 new relocations have been created:
- 'R_MICROBLAZE_TEXTPCREL_64': resolves offset of current PC to start
of text in order to set r20
- 'R_MICROBLAZE_TEXTREL_64': resolves offset of mentioned data
reference to start of text

Accordingly, both assembler and linker (binutils) have been adapted.

For extra details:
https://github.com/andrewsadek/microblaze-pic-data-text-rel/blob/pic_data_text_rel/README.md

Change Log:
---------------------

2018-03-22 Andrew Sadek  <andrew.sadek.se@gmail.com>

    Microblaze Target: PIC data text relative
    * gcc/config/microblaze/microblaze.opt: add new option
-mpic-data-text-rel.
    * gcc/config/microblaze/microblaze-protos.h (microblaze_constant_address_p):
    Add microblaze_constant_address_p function instead of the macro in
microblaze.h
    * gcc/config/microblaze/microblaze.c (TARGET_PIC_DATA_TEXT_REL):
New addressing mode
    for data-text relative position indepenedent code.
    (microblaze_classify_unspec): add 'UNSPEC_TEXT' case ->
'ADDRESS_SYMBOLIC_TXT_REL'.
    (microblaze_classify_address): add handling for UNSPEC + CONST_INT.
    (microblaze_legitimate_pic_operand): exclude function calls from
pic operands
    in case of TARGET_PIC_DATA_TEXT_REL option.
    (microblaze_legitimize_address): generate 'UNSPEC_TEXT' for all possible
    addresses cases.
    (microblaze_address_insns): add 'ADDRESS_SYMBOLIC_TXT_REL' case.
    (print_operand): add 'ADDRESS_SYMBOLIC_TXT_REL' case.
    (print_operand_address): add 'ADDRESS_SYMBOLIC_TXT_REL' case + handling for
    'address + offset'.
    (microblaze_expand_prologue): add new function prologue call for
'r20' assignation.
    (microblaze_asm_generate_pic_addr_dif_vec): override new target hook
   'TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC' to disable address diff vector
    table in case of TARGET_PIC_DATA_TEXT_REL.
    (expand_pic_symbol_ref): add handling for 'UNSPEC_TEXT'.
    * gcc/config/microblaze/microblaze.md (TARGET_PIC_DATA_TEXT_REL):
Add new macros 'UNSPEC_TEXT',
    'UNSPEC_SET_TEXT' + add rule for setting r20 in function prologue
+ exclude function calls
    from 'UNSPEC_PLT' in case of data text relative mode.
    * gcc/doc/tm.texi.in (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC): Add
new target hook for generating
    address diff vector tables in case of flag_pic.
    * gcc/doc/tm.texi : Regenerate.
    * gcc/stmt.c (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC): append new condition
    'targetm.asm_out.generate_pic_addr_diff_vec' to flag_pic in case
of addr diff vector generation.
    * gcc/target.def (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC): add
target hook definition.
    * gcc/targhooks.h, gcc/targhooks.c (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC):
    add default function for generate_pic_addr_diff_vec -> flag_pic.
    * gcc/doc/invoke.texi (Add new pic option): Add new microblaze pic
option for data text relative.


Test Results (using qemu microblaze little endian):
----------------------------------------------------------------------------

        === gcc Summary ===

# of expected passes        90874
# of unexpected failures    1317
# of unexpected successes    3
# of expected failures        207
# of unresolved testcases    115
# of unsupported tests        2828

Full summary:
https://raw.githubusercontent.com/andrewsadek/microblaze-pic-data-text-rel/pic_data_text_rel/PATCH_BUNDLE/gcc.sum

Patch:
----------

Actually, I found that gmail transforms tabs to spaces even plain text
mode, also I can not attach the patch as I receive error from
sourceware server,
so for now kindly find the patch in the link below,, if you have
solution for that please advise.


https://github.com/andrewsadek/microblaze-pic-data-text-rel/blob/pic_data_text_rel/PATCH_BUNDLE/gcc.patch

On Tue, Mar 20, 2018 at 5:30 PM, Michael Eager <eager@eagerm.com> wrote:
> Hi Andrew --
>
> I just do a visual check.  The script can help.
>
> On 03/20/2018 07:13 AM, Andrew Sadek wrote:
>>
>> Many Thanks Michael for the updates .. I was actually looking for
>> something
>> similar for my test case .. I m currently revising the Gnu code
>> conventions
>> on the patches then will send them again.
>> I m actually running the 'check_GNU_Style' in contrib folder,, is this the
>> correct way ? Is it enough ?
>>
>> Andrew
>>
>> On Tue, Mar 20, 2018, 03:30 Michael Eager <eager@eagerm.com> wrote:
>>
>>> Also check the { dg-skip-if } directive.
>>> https://gcc.gnu.org/onlinedocs/gccint/Directives.html
>>>
>>> On 03/19/2018 06:14 PM, Michael Eager wrote:
>>>>
>>>> Hi Andrew --
>>>>
>>>> Please take a look at the test case description:
>>>> https://gcc.gnu.org/wiki/HowToPrepareATestcase
>>>> and see if you can do one of the following:
>>>>     - Modify the regex expression in the scan-assembler to accept
>>>>       either format of generated output
>>>> or
>>>>     - Add { dg-option } directives to turn off your new options
>>>>       if specified.  (You should be able to specify -mno-pic....)
>>>> or
>>>>     - Duplicate the test cases and add { dg-option } directives
>>>>       to specify the correct options, with and without your
>>>>       new options.
>>>> or
>>>>     - Add test cases with a { dg-option } directive with your
>>>>       new options.
>>>>
>>>> This is not required -- your patch appears to work OK.  Normally,
>>>> the new PIC Data options would not be used when running the test
>>>> suite, so the tests would not fail.  It's just nice to have the
>>>> test suite updated when new options are added.
>>>>
>>>> On 03/19/2018 01:07 PM, Michael Eager wrote:
>>>>>
>>>>> Hi Andrew --
>>>>>
>>>>> Good work.
>>>>>
>>>>> Please submit your updated patch.  Check that you follow
>>>>> GNU coding standards.  Also make sure that the new options
>>>>> are documented in gcc/doc/invoke.texi.
>>>>>
>>>>> On 03/18/18 03:27, Andrew Sadek wrote:
>>>>>>
>>>>>> Hello Michael,
>>>>>>
>>>>>> I have run the test using the new PIC options.
>>>>>> Actually, I have discovered 2 unhandled cases in
>>>>>> 'microblaze_expand_move' + missing conditions in linker relax
>>>>>> leading some test cases execution to fail.
>>>>>> After fixing them, I made a re-run for the whole regression, and the
>>>>>> results analogy below:
>>>>>>
>>>>>> Original, without my patch:
>>>>>>           === gcc Summary ===
>>>>>>
>>>>>> # of expected passes        90776
>>>>>> # of unexpected failures    1317
>>>>>> # of unexpected successes    3
>>>>>> # of expected failures        207
>>>>>> # of unresolved testcases    115
>>>>>> # of unsupported tests        2828
>>>>>>
>>>>>> With my patch, calling '-fPIE - mpic-data-text-rel'
>>>>>>           === gcc Summary ===
>>>>>>
>>>>>> # of expected passes        90843
>>>>>> # of unexpected failures    1256
>>>>>> # of unexpected successes    3
>>>>>> # of expected failures        207
>>>>>> # of unresolved testcases    115
>>>>>> # of unsupported tests        2853
>>>>>>
>>>>>> After running the 'dg-cmp-results.sh' in contrib folder, the
>>>>>> PASS->FAIL are below:
>>>>>>
>>>>>> PASS->FAIL: gcc.dg/uninit-19.c (test for excess errors)
>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O0
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O1
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
>>>>>> -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
>>>>>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O3 -g
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -Os
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O0
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O1
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
>>>>>> -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
>>>>>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O3 -g
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -Os
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O0
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O1
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
>>>>>> -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
>>>>>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O3 -g
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -Os
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O0
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O1
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
>>>>>> -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
>>>>>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O3 -g
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -Os
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O0
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O1
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
>>>>>> -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
>>>>>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O3 -g
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -Os
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O0
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O1
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
>>>>>> -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
>>>>>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O3 -g
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -Os
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O0
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O1
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2
>>>>>> -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2
>>>>>> -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O3 -g
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -Os
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O0
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O1
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2
>>>>>> -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2
>>>>>> -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O3 -g
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -Os
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>
>>>>>> the 'gcc.dg/uninit-19.c ' already fails with -fPIE, and for the
>>>>>> others in microblaze,
>>>>>> expectation is r0 or r13 as a base register which is not the case
>>>>>> here 'r20', and these tests also fails with -fPIE.
>>>>>> Moreover, the test cases that failed due 'unresolved
>>>>>> GLOBAL_OFFSET_TABLE' now pass as we do not have GOT in data text
>>>>>> relative.
>>>>>>
>>>>>> Please tell me if any adjustments needed or If I need to re-run
>>>
>>> nything.
>>>>>>
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> On Sun, Mar 18, 2018 at 12:25 PM, Andrew Sadek
>>>>>> <andrew.sadek.se@gmail.com <mailto:andrew.sadek.se@gmail.com>> wrote:
>>>>>>
>>>>>>      Hello Michael,
>>>>>>
>>>>>>      I have run the test using the new PIC options.
>>>>>>      Actually, I have discovered 2 unhandled cases in
>>>>>>      'microblaze_expand_move' + missing conditions in linker relax
>>>>>>      leading some test cases execution to fail.
>>>>>>      After fixing them, I made a re-run for the whole regression, and
>>>
>>> the
>>>>>>
>>>>>>      results analogy below:
>>>>>>
>>>>>>      Original, without my patch:
>>>>>>               === gcc Summary ===
>>>>>>
>>>>>>      # of expected passes        90776
>>>>>>      # of unexpected failures    1317
>>>>>>      # of unexpected successes    3
>>>>>>      # of expected failures        207
>>>>>>      # of unresolved testcases    115
>>>>>>      # of unsupported tests        2828
>>>>>>
>>>>>>      With my patch, calling '-fPIE - mpic-data-text-rel'
>>>>>>               === gcc Summary ===
>>>>>>
>>>>>>      # of expected passes        90843
>>>>>>      # of unexpected failures    1256
>>>>>>      # of unexpected successes    3
>>>>>>      # of expected failures        207
>>>>>>      # of unresolved testcases    115
>>>>>>      # of unsupported tests        2853
>>>>>>
>>>>>>      After running the 'dg-cmp-results.sh' in contrib folder, the
>>>>>>      PASS->FAIL are below:
>>>>>>
>>>>>>      PASS->FAIL: gcc.dg/uninit-19.c (test for excess errors)
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O0
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O1
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
>>>>>>      -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
>>>>>>      -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O3 -g
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -Os
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O0
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O1
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
>>>>>>      -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
>>>>>>      -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O3 -g
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -Os
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O0
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O1
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
>>>>>>      -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
>>>>>>      -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O3 -g
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -Os
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O0
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O1
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
>>>>>>      -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
>>>>>>      -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O3 -g
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -Os
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O0
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O1
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
>>>>>>      -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
>>>>>>      -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O3 -g
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -Os
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O0
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O1
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
>>>>>>      -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
>>>>>>      -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O3 -g
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -Os
>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c
>>>>>> -O0     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c
>>>>>> -O1     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c
>>>>>> -O2
>>>>>>      -flto -fno-use-linker-plugin -flto-partition=none
>>>>>> scan-assembler
>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c
>>>>>> -O2
>>>>>>      -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c
>>>>>> -O2     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c
>>>>>> -O3
>>>>>>      -g   scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c
>>>>>> -Os     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c
>>>>>> -O0     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c
>>>>>> -O1     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c
>>>>>> -O2
>>>>>>      -flto -fno-use-linker-plugin -flto-partition=none
>>>>>> scan-assembler
>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c
>>>>>> -O2
>>>>>>      -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c
>>>>>> -O2     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c
>>>>>> -O3
>>>>>>      -g   scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c
>>>>>> -Os     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>
>>>>>>      the 'gcc.dg/uninit-19.c ' already fails with -fPIE, and for the
>>>>>>      others in microblaze,
>>>>>>      expectation is r0 or r13 as a base register which is not the case
>>>>>>      here 'r20', and these tests also fails with -fPIE.
>>>>>>      Moreover, the test cases that failed due 'unresolved
>>>>>>      GLOBAL_OFFSET_TABLE' now pass as we do not have GOT in data text
>>>>>>      relative.
>>>>>>
>>>>>>      Attached the compare output of the scripit with verbosity 2.
>>>>>>      Please tell me if any adjustments needed or If I need to re-run
>>>>>> nything.
>>>>>>
>>>>>>      Thanks
>>>>>>
>>>>>>
>>>>>>      On Tue, Mar 13, 2018 at 10:44 PM, Michael Eager <eager@eagerm.com
>>>>>>      <mailto:eager@eagerm.com>> wrote:
>>>>>>
>>>>>>          On 03/13/18 00:56, Andrew Sadek wrote:
>>>>>>
>>>>>>              Ok, so you mean with '-fPIC -mpic-data-text-relative' as
>>>>>> I
>>>>>>              do in my test case ?
>>>>>>              If all is Ok, execution and compilation shall ideally
>>>>>> pass
>>>>>>              for the test cases.
>>>>>>
>>>>>>
>>>>>>          Correct.
>>>>>>
>>>>>>          I want to make sure of two things:
>>>>>>             -- Your patch doesn't break anything (i.e., cause a
>>>>>>          regression) when
>>>>>>                you don't use the options.  This seems complete.
>>>>>>             -- Your patch works as intended when you do use the
>>>>>> options.
>>>>>>
>>>>>>              But I have noticed that there are some output pattern
>>>
>>> checks
>>>>>>
>>>>>>              done in some test cases and this may fail since the
>>>>>> output
>>>>>>              assembly is different,
>>>>>>              anyway I shall give it a try and send you the results
>>>>>> with
>>>>>>              the new options.
>>>>>>
>>>>>>
>>>>>>          There should be no target dependencies in the generic GCC
>>>
>>> tests.
>>>>>>
>>>>>>          Different instruction patterns which generate the correct
>>>>>>          results should
>>>>>>          not be a problem.
>>>>>>
>>>>>>
>>>>>>          --         Michael Eager eager@eagerm.com
>>>>>> <mailto:eager@eagerm.com>
>>>>>>          1960 Park Blvd., Palo Alto, CA 94306
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>      --
>>>>>>      Andrew
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>>
>>>>>> Andrew
>>>>>
>>>>>
>>>>
>>>
>>> --
>>> Michael Eager    eager@eagerm.com
>>> 1960 Park Blvd., Palo Alto, CA 94306
>>>
>>
>
> --
> Michael Eager    eager@eagerm.com
> 1960 Park Blvd., Palo Alto, CA 94306



-- 

Andrew

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

* Re: [PATCH] [Microblaze]: PIC Data Text Relative
  2018-03-22 18:45                                   ` Andrew Sadek
@ 2018-04-18 12:44                                     ` Andrew Sadek
  2018-04-18 16:57                                       ` Michael Eager
  0 siblings, 1 reply; 27+ messages in thread
From: Andrew Sadek @ 2018-04-18 12:44 UTC (permalink / raw)
  To: Michael Eager; +Cc: gcc-patches, nmekala, Michael Eager

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

Hello Michael,

I have attached the patch as well,
(the same as in :
https://github.com/andrewsadek/microblaze-pic-data-text-rel/blob/pic_data_text_rel/PATCH_BUNDLE/gcc.patch)

On Thu, Mar 22, 2018 at 8:37 PM, Andrew Sadek <andrew.sadek.se@gmail.com> wrote:
> Hello Michael,
>
> I have adapted the test cases.
>
> Please find the patch below with Change log, description and test results.
>
> Description:
> ------------------
>
> This branch is regarding a new implemented feature in GCC Microblaze
> that allows Position Independent Code to run using Data Text Relative
> addressing instead of using Global Offset Table.
>
> Its aim was to make 'PIC' more efficient and flexible as elf size
> excess/ performance overhead were noticed when using GOT due to the
> indirect addressing.
> The change was tested with the dhrystone benchmark on a real Hardware
> (Xilinx FPGA Spartan 6) and the test report went successfully for all
> optimization levels.
>
> Indeed, Microblaze does not support PC-relative addressing in Hardware like ARM.
> The idea was to store the start address of current text section in
> 'r20' instead of GOT, in the function prologue. Correspondingly, data
> references will be an offset from the original reference value to the
> start of text thus being added to the 'r20' base register will resolve
> the actual address.
>
> Henceforth, 2 new relocations have been created:
> - 'R_MICROBLAZE_TEXTPCREL_64': resolves offset of current PC to start
> of text in order to set r20
> - 'R_MICROBLAZE_TEXTREL_64': resolves offset of mentioned data
> reference to start of text
>
> Accordingly, both assembler and linker (binutils) have been adapted.
>
> For extra details:
> https://github.com/andrewsadek/microblaze-pic-data-text-rel/blob/pic_data_text_rel/README.md
>
> Change Log:
> ---------------------
>
> 2018-03-22 Andrew Sadek  <andrew.sadek.se@gmail.com>
>
>     Microblaze Target: PIC data text relative
>     * gcc/config/microblaze/microblaze.opt: add new option
> -mpic-data-text-rel.
>     * gcc/config/microblaze/microblaze-protos.h (microblaze_constant_address_p):
>     Add microblaze_constant_address_p function instead of the macro in
> microblaze.h
>     * gcc/config/microblaze/microblaze.c (TARGET_PIC_DATA_TEXT_REL):
> New addressing mode
>     for data-text relative position indepenedent code.
>     (microblaze_classify_unspec): add 'UNSPEC_TEXT' case ->
> 'ADDRESS_SYMBOLIC_TXT_REL'.
>     (microblaze_classify_address): add handling for UNSPEC + CONST_INT.
>     (microblaze_legitimate_pic_operand): exclude function calls from
> pic operands
>     in case of TARGET_PIC_DATA_TEXT_REL option.
>     (microblaze_legitimize_address): generate 'UNSPEC_TEXT' for all possible
>     addresses cases.
>     (microblaze_address_insns): add 'ADDRESS_SYMBOLIC_TXT_REL' case.
>     (print_operand): add 'ADDRESS_SYMBOLIC_TXT_REL' case.
>     (print_operand_address): add 'ADDRESS_SYMBOLIC_TXT_REL' case + handling for
>     'address + offset'.
>     (microblaze_expand_prologue): add new function prologue call for
> 'r20' assignation.
>     (microblaze_asm_generate_pic_addr_dif_vec): override new target hook
>    'TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC' to disable address diff vector
>     table in case of TARGET_PIC_DATA_TEXT_REL.
>     (expand_pic_symbol_ref): add handling for 'UNSPEC_TEXT'.
>     * gcc/config/microblaze/microblaze.md (TARGET_PIC_DATA_TEXT_REL):
> Add new macros 'UNSPEC_TEXT',
>     'UNSPEC_SET_TEXT' + add rule for setting r20 in function prologue
> + exclude function calls
>     from 'UNSPEC_PLT' in case of data text relative mode.
>     * gcc/doc/tm.texi.in (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC): Add
> new target hook for generating
>     address diff vector tables in case of flag_pic.
>     * gcc/doc/tm.texi : Regenerate.
>     * gcc/stmt.c (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC): append new condition
>     'targetm.asm_out.generate_pic_addr_diff_vec' to flag_pic in case
> of addr diff vector generation.
>     * gcc/target.def (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC): add
> target hook definition.
>     * gcc/targhooks.h, gcc/targhooks.c (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC):
>     add default function for generate_pic_addr_diff_vec -> flag_pic.
>     * gcc/doc/invoke.texi (Add new pic option): Add new microblaze pic
> option for data text relative.
>
>
> Test Results (using qemu microblaze little endian):
> ----------------------------------------------------------------------------
>
>         === gcc Summary ===
>
> # of expected passes        90874
> # of unexpected failures    1317
> # of unexpected successes    3
> # of expected failures        207
> # of unresolved testcases    115
> # of unsupported tests        2828
>
> Full summary:
> https://raw.githubusercontent.com/andrewsadek/microblaze-pic-data-text-rel/pic_data_text_rel/PATCH_BUNDLE/gcc.sum
>
> Patch:
> ----------
>
> Actually, I found that gmail transforms tabs to spaces even plain text
> mode, also I can not attach the patch as I receive error from
> sourceware server,
> so for now kindly find the patch in the link below,, if you have
> solution for that please advise.
>
>
> https://github.com/andrewsadek/microblaze-pic-data-text-rel/blob/pic_data_text_rel/PATCH_BUNDLE/gcc.patch
>
> On Tue, Mar 20, 2018 at 5:30 PM, Michael Eager <eager@eagerm.com> wrote:
>> Hi Andrew --
>>
>> I just do a visual check.  The script can help.
>>
>> On 03/20/2018 07:13 AM, Andrew Sadek wrote:
>>>
>>> Many Thanks Michael for the updates .. I was actually looking for
>>> something
>>> similar for my test case .. I m currently revising the Gnu code
>>> conventions
>>> on the patches then will send them again.
>>> I m actually running the 'check_GNU_Style' in contrib folder,, is this the
>>> correct way ? Is it enough ?
>>>
>>> Andrew
>>>
>>> On Tue, Mar 20, 2018, 03:30 Michael Eager <eager@eagerm.com> wrote:
>>>
>>>> Also check the { dg-skip-if } directive.
>>>> https://gcc.gnu.org/onlinedocs/gccint/Directives.html
>>>>
>>>> On 03/19/2018 06:14 PM, Michael Eager wrote:
>>>>>
>>>>> Hi Andrew --
>>>>>
>>>>> Please take a look at the test case description:
>>>>> https://gcc.gnu.org/wiki/HowToPrepareATestcase
>>>>> and see if you can do one of the following:
>>>>>     - Modify the regex expression in the scan-assembler to accept
>>>>>       either format of generated output
>>>>> or
>>>>>     - Add { dg-option } directives to turn off your new options
>>>>>       if specified.  (You should be able to specify -mno-pic....)
>>>>> or
>>>>>     - Duplicate the test cases and add { dg-option } directives
>>>>>       to specify the correct options, with and without your
>>>>>       new options.
>>>>> or
>>>>>     - Add test cases with a { dg-option } directive with your
>>>>>       new options.
>>>>>
>>>>> This is not required -- your patch appears to work OK.  Normally,
>>>>> the new PIC Data options would not be used when running the test
>>>>> suite, so the tests would not fail.  It's just nice to have the
>>>>> test suite updated when new options are added.
>>>>>
>>>>> On 03/19/2018 01:07 PM, Michael Eager wrote:
>>>>>>
>>>>>> Hi Andrew --
>>>>>>
>>>>>> Good work.
>>>>>>
>>>>>> Please submit your updated patch.  Check that you follow
>>>>>> GNU coding standards.  Also make sure that the new options
>>>>>> are documented in gcc/doc/invoke.texi.
>>>>>>
>>>>>> On 03/18/18 03:27, Andrew Sadek wrote:
>>>>>>>
>>>>>>> Hello Michael,
>>>>>>>
>>>>>>> I have run the test using the new PIC options.
>>>>>>> Actually, I have discovered 2 unhandled cases in
>>>>>>> 'microblaze_expand_move' + missing conditions in linker relax
>>>>>>> leading some test cases execution to fail.
>>>>>>> After fixing them, I made a re-run for the whole regression, and the
>>>>>>> results analogy below:
>>>>>>>
>>>>>>> Original, without my patch:
>>>>>>>           === gcc Summary ===
>>>>>>>
>>>>>>> # of expected passes        90776
>>>>>>> # of unexpected failures    1317
>>>>>>> # of unexpected successes    3
>>>>>>> # of expected failures        207
>>>>>>> # of unresolved testcases    115
>>>>>>> # of unsupported tests        2828
>>>>>>>
>>>>>>> With my patch, calling '-fPIE - mpic-data-text-rel'
>>>>>>>           === gcc Summary ===
>>>>>>>
>>>>>>> # of expected passes        90843
>>>>>>> # of unexpected failures    1256
>>>>>>> # of unexpected successes    3
>>>>>>> # of expected failures        207
>>>>>>> # of unresolved testcases    115
>>>>>>> # of unsupported tests        2853
>>>>>>>
>>>>>>> After running the 'dg-cmp-results.sh' in contrib folder, the
>>>>>>> PASS->FAIL are below:
>>>>>>>
>>>>>>> PASS->FAIL: gcc.dg/uninit-19.c (test for excess errors)
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O0
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O1
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
>>>>>>> -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
>>>>>>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O3 -g
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -Os
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O0
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O1
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
>>>>>>> -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
>>>>>>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O3 -g
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -Os
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O0
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O1
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
>>>>>>> -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
>>>>>>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O3 -g
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -Os
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O0
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O1
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
>>>>>>> -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
>>>>>>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O3 -g
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -Os
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O0
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O1
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
>>>>>>> -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
>>>>>>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O3 -g
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -Os
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O0
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O1
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
>>>>>>> -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
>>>>>>> -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O3 -g
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -Os
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O0
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O1
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2
>>>>>>> -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2
>>>>>>> -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O2
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -O3 -g
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c   -Os
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O0
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O1
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2
>>>>>>> -flto -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2
>>>>>>> -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>>> lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O2
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -O3 -g
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>> PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c   -Os
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>
>>>>>>> the 'gcc.dg/uninit-19.c ' already fails with -fPIE, and for the
>>>>>>> others in microblaze,
>>>>>>> expectation is r0 or r13 as a base register which is not the case
>>>>>>> here 'r20', and these tests also fails with -fPIE.
>>>>>>> Moreover, the test cases that failed due 'unresolved
>>>>>>> GLOBAL_OFFSET_TABLE' now pass as we do not have GOT in data text
>>>>>>> relative.
>>>>>>>
>>>>>>> Please tell me if any adjustments needed or If I need to re-run
>>>>
>>>> nything.
>>>>>>>
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>> On Sun, Mar 18, 2018 at 12:25 PM, Andrew Sadek
>>>>>>> <andrew.sadek.se@gmail.com <mailto:andrew.sadek.se@gmail.com>> wrote:
>>>>>>>
>>>>>>>      Hello Michael,
>>>>>>>
>>>>>>>      I have run the test using the new PIC options.
>>>>>>>      Actually, I have discovered 2 unhandled cases in
>>>>>>>      'microblaze_expand_move' + missing conditions in linker relax
>>>>>>>      leading some test cases execution to fail.
>>>>>>>      After fixing them, I made a re-run for the whole regression, and
>>>>
>>>> the
>>>>>>>
>>>>>>>      results analogy below:
>>>>>>>
>>>>>>>      Original, without my patch:
>>>>>>>               === gcc Summary ===
>>>>>>>
>>>>>>>      # of expected passes        90776
>>>>>>>      # of unexpected failures    1317
>>>>>>>      # of unexpected successes    3
>>>>>>>      # of expected failures        207
>>>>>>>      # of unresolved testcases    115
>>>>>>>      # of unsupported tests        2828
>>>>>>>
>>>>>>>      With my patch, calling '-fPIE - mpic-data-text-rel'
>>>>>>>               === gcc Summary ===
>>>>>>>
>>>>>>>      # of expected passes        90843
>>>>>>>      # of unexpected failures    1256
>>>>>>>      # of unexpected successes    3
>>>>>>>      # of expected failures        207
>>>>>>>      # of unresolved testcases    115
>>>>>>>      # of unsupported tests        2853
>>>>>>>
>>>>>>>      After running the 'dg-cmp-results.sh' in contrib folder, the
>>>>>>>      PASS->FAIL are below:
>>>>>>>
>>>>>>>      PASS->FAIL: gcc.dg/uninit-19.c (test for excess errors)
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O0
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O1
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
>>>>>>>      -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2 -flto
>>>>>>>      -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O2
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -O3 -g
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var1.c   -Os
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O0
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O1
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
>>>>>>>      -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2 -flto
>>>>>>>      -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O2
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -O3 -g
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/data_var2.c   -Os
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r0
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O0
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O1
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
>>>>>>>      -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2 -flto
>>>>>>>      -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O2
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -O3 -g
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var1.c   -Os
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O0
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O1
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
>>>>>>>      -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2 -flto
>>>>>>>      -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O2
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -O3 -g
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var2.c   -Os
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O0
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O1
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
>>>>>>>      -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2 -flto
>>>>>>>      -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O2
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -O3 -g
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var4.c   -Os
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O0
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O1
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
>>>>>>>      -fno-use-linker-plugin -flto-partition=none   scan-assembler
>>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2 -flto
>>>>>>>      -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O2
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -O3 -g
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/sdata_var5.c   -Os
>>>>>>> scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c
>>>>>>> -O0     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c
>>>>>>> -O1     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c
>>>>>>> -O2
>>>>>>>      -flto -fno-use-linker-plugin -flto-partition=none
>>>>>>> scan-assembler
>>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c
>>>>>>> -O2
>>>>>>>      -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c
>>>>>>> -O2     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c
>>>>>>> -O3
>>>>>>>      -g   scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst1_gpopt.c
>>>>>>> -Os     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c
>>>>>>> -O0     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c
>>>>>>> -O1     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c
>>>>>>> -O2
>>>>>>>      -flto -fno-use-linker-plugin -flto-partition=none
>>>>>>> scan-assembler
>>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c
>>>>>>> -O2
>>>>>>>      -flto -fuse-linker-plugin -fno-fat-lto-objects   scan-assembler
>>>>>>>      lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c
>>>>>>> -O2     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c
>>>>>>> -O3
>>>>>>>      -g   scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>      PASS->FAIL: gcc.target/microblaze/others/string_cst2_gpopt.c
>>>>>>> -Os     scan-assembler lwi\tr([0-9]|[1-2][0-9]|3[0-1]),r13
>>>>>>>
>>>>>>>      the 'gcc.dg/uninit-19.c ' already fails with -fPIE, and for the
>>>>>>>      others in microblaze,
>>>>>>>      expectation is r0 or r13 as a base register which is not the case
>>>>>>>      here 'r20', and these tests also fails with -fPIE.
>>>>>>>      Moreover, the test cases that failed due 'unresolved
>>>>>>>      GLOBAL_OFFSET_TABLE' now pass as we do not have GOT in data text
>>>>>>>      relative.
>>>>>>>
>>>>>>>      Attached the compare output of the scripit with verbosity 2.
>>>>>>>      Please tell me if any adjustments needed or If I need to re-run
>>>>>>> nything.
>>>>>>>
>>>>>>>      Thanks
>>>>>>>
>>>>>>>
>>>>>>>      On Tue, Mar 13, 2018 at 10:44 PM, Michael Eager <eager@eagerm.com
>>>>>>>      <mailto:eager@eagerm.com>> wrote:
>>>>>>>
>>>>>>>          On 03/13/18 00:56, Andrew Sadek wrote:
>>>>>>>
>>>>>>>              Ok, so you mean with '-fPIC -mpic-data-text-relative' as
>>>>>>> I
>>>>>>>              do in my test case ?
>>>>>>>              If all is Ok, execution and compilation shall ideally
>>>>>>> pass
>>>>>>>              for the test cases.
>>>>>>>
>>>>>>>
>>>>>>>          Correct.
>>>>>>>
>>>>>>>          I want to make sure of two things:
>>>>>>>             -- Your patch doesn't break anything (i.e., cause a
>>>>>>>          regression) when
>>>>>>>                you don't use the options.  This seems complete.
>>>>>>>             -- Your patch works as intended when you do use the
>>>>>>> options.
>>>>>>>
>>>>>>>              But I have noticed that there are some output pattern
>>>>
>>>> checks
>>>>>>>
>>>>>>>              done in some test cases and this may fail since the
>>>>>>> output
>>>>>>>              assembly is different,
>>>>>>>              anyway I shall give it a try and send you the results
>>>>>>> with
>>>>>>>              the new options.
>>>>>>>
>>>>>>>
>>>>>>>          There should be no target dependencies in the generic GCC
>>>>
>>>> tests.
>>>>>>>
>>>>>>>          Different instruction patterns which generate the correct
>>>>>>>          results should
>>>>>>>          not be a problem.
>>>>>>>
>>>>>>>
>>>>>>>          --         Michael Eager eager@eagerm.com
>>>>>>> <mailto:eager@eagerm.com>
>>>>>>>          1960 Park Blvd., Palo Alto, CA 94306
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>      --
>>>>>>>      Andrew
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>> Andrew
>>>>>>
>>>>>>
>>>>>
>>>>
>>>> --
>>>> Michael Eager    eager@eagerm.com
>>>> 1960 Park Blvd., Palo Alto, CA 94306
>>>>
>>>
>>
>> --
>> Michael Eager    eager@eagerm.com
>> 1960 Park Blvd., Palo Alto, CA 94306
>
>
>
> --
>
> Andrew



-- 

Andrew

[-- Attachment #2: gcc.patch.txt --]
[-- Type: text/plain, Size: 26273 bytes --]

Index: gcc/config/microblaze/microblaze-protos.h
===================================================================
--- gcc/config/microblaze/microblaze-protos.h	(revision 258413)
+++ gcc/config/microblaze/microblaze-protos.h	(working copy)
@@ -24,6 +24,7 @@
 
 #ifdef RTX_CODE
 extern int pic_address_needs_scratch (rtx);
+extern bool microblaze_constant_address_p (rtx x);
 extern void expand_block_move        (rtx *);
 extern void microblaze_expand_prologue (void);
 extern void microblaze_expand_epilogue (void);
Index: gcc/config/microblaze/microblaze.c
===================================================================
--- gcc/config/microblaze/microblaze.c	(revision 258413)
+++ gcc/config/microblaze/microblaze.c	(working copy)
@@ -91,7 +91,8 @@ enum microblaze_address_type
   ADDRESS_SYMBOLIC,
   ADDRESS_GOTOFF,
   ADDRESS_PLT,
-  ADDRESS_TLS
+  ADDRESS_TLS,
+  ADDRESS_SYMBOLIC_TXT_REL
 };
 
 /* Classifies symbols
@@ -650,6 +651,10 @@ microblaze_classify_unspec (struct microblaze_addr
       info->type = ADDRESS_TLS;
       info->tls_type = tls_reloc (INTVAL (XVECEXP (x, 0, 1)));
     }
+  else if (XINT (x, 1) == UNSPEC_TEXT)
+    {
+	  info->type = ADDRESS_SYMBOLIC_TXT_REL;
+    }
   else
     {
       return false;
@@ -728,6 +733,7 @@ microblaze_classify_address (struct microblaze_add
 {
   rtx xplus0;
   rtx xplus1;
+  rtx offset;
 
   info->type = ADDRESS_INVALID;
   info->regA = NULL;
@@ -735,6 +741,7 @@ microblaze_classify_address (struct microblaze_add
   info->offset = NULL;
   info->symbol = NULL;
   info->symbol_type = SYMBOL_TYPE_INVALID;
+  offset = NULL;
 
   switch (GET_CODE (x))
     {
@@ -795,9 +802,14 @@ microblaze_classify_address (struct microblaze_add
 		/* for (plus x const_int) just look at x.  */
 		if (GET_CODE (xconst0) == PLUS
 		    && GET_CODE (XEXP (xconst0, 1)) == CONST_INT
-		    && SMALL_INT (XEXP (xconst0, 1)))
+		    && (SMALL_INT (XEXP (xconst0, 1))
+		       || GET_CODE (XEXP (xconst0, 0)) == UNSPEC))
 		  {
-		    /* This is ok as info->symbol is set to xplus1 the full
+			 /* Hold CONST_INT Value in offset in case of
+		       UNSPEC + CONST_INT.  */
+			offset = XEXP (xconst0, 1);
+
+			/* This is ok as info->symbol is set to xplus1 the full
 		       const-expression below.  */
 		    xconst0 = XEXP (xconst0, 0);
 		  }
@@ -814,6 +826,15 @@ microblaze_classify_address (struct microblaze_add
 		    return true;
 		  }
 
+		if (GET_CODE (xconst0) == UNSPEC && TARGET_PIC_DATA_TEXT_REL)
+		  {
+		    if (GET_MODE_SIZE (mode) > UNITS_PER_WORD)
+		      return false;
+
+		    info->offset = offset;
+		    return microblaze_classify_unspec (info, xconst0);
+		  }
+
 		/* Not base + symbol || base + UNSPEC.  */
 		return false;
 
@@ -858,6 +879,16 @@ microblaze_classify_address (struct microblaze_add
 	     return !(flag_pic && pic_address_needs_scratch (x));
 	  }
 
+	/* Avoid error in print_operand_address in case UNSPEC
+	 is removed from SYMBOL or LABEL REFS during optimization.  */
+	if ((GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF)
+		&& flag_pic && TARGET_PIC_DATA_TEXT_REL
+		&& strict == 2)
+	  {
+	    info->type = ADDRESS_SYMBOLIC_TXT_REL;
+	    return true;
+	  }
+
 	if (flag_pic == 2)
 	  return false;
 	else if (microblaze_tls_symbol_p(x))
@@ -891,8 +922,18 @@ microblaze_legitimate_address_p (machine_mode mode
   struct microblaze_address_info addr;
 
   return microblaze_classify_address (&addr, x, mode, strict);
+
 }
 
+bool
+microblaze_constant_address_p (rtx x)
+{
+  return ((GET_CODE (x) == LABEL_REF) || (GET_CODE (x) == SYMBOL_REF)
+		  || GET_CODE (x) == CONST_INT
+		  || (GET_CODE (x) == CONST
+		  && ! (flag_pic && pic_address_needs_scratch (x))));
+}
+
 int
 microblaze_valid_pic_const (rtx x)
 {
@@ -910,9 +951,11 @@ microblaze_valid_pic_const (rtx x)
 int
 microblaze_legitimate_pic_operand (rtx x)
 {
-  if (flag_pic == 2 && (symbol_mentioned_p(x) || label_mentioned_p(x)))
+  if (flag_pic == 2 && (symbol_mentioned_p (x) || label_mentioned_p (x))
+      && !(TARGET_PIC_DATA_TEXT_REL && call_insn_operand (x,VOIDmode)))
     return 0;
 
+
   if (microblaze_tls_referenced_p(x))
     return 0;
 
@@ -1022,7 +1065,7 @@ microblaze_legitimize_address (rtx x, rtx oldx ATT
 
 		  return result;
 		}
-	      else if (flag_pic == 2)
+	      else if (flag_pic == 2 && !TARGET_PIC_DATA_TEXT_REL)
 		{
 		  rtx pic_ref, reg;
 		  reg = gen_reg_rtx (Pmode);
@@ -1036,7 +1079,19 @@ microblaze_legitimize_address (rtx x, rtx oldx ATT
 		  result = gen_rtx_PLUS (Pmode, xplus0, reg);
 		  return result;
 		}
+	      else if (flag_pic == 2 && TARGET_PIC_DATA_TEXT_REL)
+	    {
+	      rtx pic_ref, reg;
+	      reg = gen_reg_rtx (Pmode);
+	  	  pic_ref = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, xplus1),
+					    UNSPEC_TEXT);
+	      pic_ref = gen_rtx_CONST (Pmode, pic_ref);
+	      emit_insn (gen_addsi3 (reg, pic_offset_table_rtx, xplus0));
+	      result = gen_rtx_PLUS (Pmode, reg, pic_ref);
+	      return result;
+
 	    }
+	    }
 	}
     }
 
@@ -1047,7 +1102,7 @@ microblaze_legitimize_address (rtx x, rtx oldx ATT
         {
           reg = microblaze_legitimize_tls_address (xinsn, NULL_RTX);
         }
-      else
+      else if (flag_pic == 2 && !TARGET_PIC_DATA_TEXT_REL)
         {
           rtx pic_ref;
 
@@ -1060,6 +1115,19 @@ microblaze_legitimize_address (rtx x, rtx oldx ATT
           pic_ref = gen_const_mem (Pmode, pic_ref);
           reg = pic_ref;
         }
+      else if (flag_pic == 2 && TARGET_PIC_DATA_TEXT_REL)
+	    {
+    	  rtx pic_ref;
+
+    	  if (reload_in_progress)
+    		  df_set_regs_ever_live (PIC_OFFSET_TABLE_REGNUM, true);
+
+    	  pic_ref = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, xinsn), UNSPEC_TEXT);
+    	  pic_ref = gen_rtx_CONST (Pmode, pic_ref);
+    	  pic_ref = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, pic_ref);
+    	  reg = pic_ref;
+
+	    }
       return reg;
     }
 
@@ -1388,6 +1456,7 @@ microblaze_address_insns (rtx x, machine_mode mode
 	case ADDRESS_REG_INDEX:
 	  return 1;
 	case ADDRESS_SYMBOLIC:
+	case ADDRESS_SYMBOLIC_TXT_REL:
 	case ADDRESS_GOTOFF:
 	  return 2;
 	case ADDRESS_TLS:
@@ -2066,7 +2135,7 @@ compute_frame_size (HOST_WIDE_INT size)
 
   total_size = var_size + args_size;
 
-  if (flag_pic == 2)
+  if (flag_pic == 2 && !TARGET_PIC_DATA_TEXT_REL)
     /* force setting GOT.  */
     df_set_regs_ever_live (MB_ABI_PIC_ADDR_REGNUM, true);
 
@@ -2322,6 +2391,7 @@ print_operand (FILE * file, rtx op, int letter)
 	    case ADDRESS_REG:
 	    case ADDRESS_CONST_INT:
 	    case ADDRESS_SYMBOLIC:
+	    case ADDRESS_SYMBOLIC_TXT_REL:
 	    case ADDRESS_GOTOFF:
 	    case ADDRESS_TLS:
 	      fputs ("i", file);
@@ -2489,7 +2559,7 @@ print_operand_address (FILE * file, rtx addr)
 {
   struct microblaze_address_info info;
   enum microblaze_address_type type;
-  if (!microblaze_classify_address (&info, addr, GET_MODE (addr), 1))
+  if (!microblaze_classify_address (&info, addr, GET_MODE (addr), 2))
     fatal_insn ("insn contains an invalid address !", addr);
 
   type = info.type;
@@ -2515,6 +2585,7 @@ print_operand_address (FILE * file, rtx addr)
       output_addr_const (file, info.offset);
       break;
     case ADDRESS_SYMBOLIC:
+    case ADDRESS_SYMBOLIC_TXT_REL:
     case ADDRESS_GOTOFF:
     case ADDRESS_PLT:
     case ADDRESS_TLS:
@@ -2529,6 +2600,16 @@ print_operand_address (FILE * file, rtx addr)
 	{
 	  fputs ("@PLT", file);
 	}
+      else if (type == ADDRESS_SYMBOLIC_TXT_REL)
+    {
+      if (info.offset != NULL && CONST_INT_P (info.offset)
+	      && INTVAL (info.offset) > 0)
+    	{
+    	  fprintf (file, "+");
+    	  output_addr_const (file, info.offset);
+    	}
+      fputs ("@TXTREL", file);
+    }
       else if (type == ADDRESS_TLS)
 	{
 	  switch (info.tls_type)
@@ -2960,8 +3041,19 @@ microblaze_expand_prologue (void)
   if ((flag_pic == 2 || TLS_NEEDS_GOT )
       && df_regs_ever_live_p (MB_ABI_PIC_ADDR_REGNUM))
     {
-      SET_REGNO (pic_offset_table_rtx, MB_ABI_PIC_ADDR_REGNUM);
-      emit_insn (gen_set_got (pic_offset_table_rtx));	/* setting GOT.  */
+	  if ((flag_pic == 2 && !TARGET_PIC_DATA_TEXT_REL) || TLS_NEEDS_GOT)
+	    {
+		  SET_REGNO (pic_offset_table_rtx, MB_ABI_PIC_ADDR_REGNUM);
+		  /* setting GOT.  */
+		  emit_insn (gen_set_got (pic_offset_table_rtx));
+	    }
+      else
+	    {
+    	  SET_REGNO (pic_offset_table_rtx, MB_ABI_PIC_ADDR_REGNUM);
+       	  /* setting start of text.  */
+		  emit_insn (gen_set_text (pic_offset_table_rtx));
+
+	    }
     }
 
   /* If we are profiling, make sure no instructions are scheduled before
@@ -3154,7 +3246,15 @@ microblaze_elf_in_small_data_p (const_tree decl)
   return (size > 0 && size <= microblaze_section_threshold);
 }
 
+/* We need to disable address diff vectors in
+case of pic data text relative mode.  */
 
+static bool
+microblaze_gen_pic_addr_dif_vec (void)
+{
+  return (flag_pic && !TARGET_PIC_DATA_TEXT_REL);
+}
+
 static section *
 microblaze_select_section (tree decl, int reloc, unsigned HOST_WIDE_INT align)
 {
@@ -3187,10 +3287,19 @@ static rtx
 expand_pic_symbol_ref (machine_mode mode ATTRIBUTE_UNUSED, rtx op)
 {
   rtx result;
-  result = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, op), UNSPEC_GOTOFF);
+  bool isFunc = (GET_CODE (op) == SYMBOL_REF
+			     && (SYMBOL_REF_FLAGS (op) & SYMBOL_FLAG_FUNCTION));
+  result = (!TARGET_PIC_DATA_TEXT_REL)
+		  ? gen_rtx_UNSPEC (Pmode, gen_rtvec (1, op), UNSPEC_GOTOFF):
+		   gen_rtx_UNSPEC (Pmode, gen_rtvec (1, op), UNSPEC_TEXT);
   result = gen_rtx_CONST (Pmode, result);
-  result = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, result);
-  result = gen_const_mem (Pmode, result);
+  result = (TARGET_PIC_DATA_TEXT_REL && isFunc)
+		  ? gen_rtx_PLUS (Pmode, gen_raw_REG (Pmode,
+		    get_base_reg (op)), result):
+			gen_rtx_PLUS (Pmode, pic_offset_table_rtx, result);
+  result = (!TARGET_PIC_DATA_TEXT_REL)
+		  ? gen_const_mem (Pmode, result) : result;
+
   return result;
 }
 
@@ -3294,10 +3403,38 @@ microblaze_expand_move (machine_mode mode, rtx ope
 	  if (reload_in_progress)
 	    df_set_regs_ever_live (PIC_OFFSET_TABLE_REGNUM, true);
 	  result = expand_pic_symbol_ref (mode, op1);
+
+	  if (TARGET_PIC_DATA_TEXT_REL && GET_CODE (op0) == REG
+	      && REGNO (op0) >= FIRST_PSEUDO_REGISTER)
+		    result = force_reg (SImode, result);
+
 	  emit_move_insn (op0, result);
 	  return true;
 	}
     }
+  if (GET_CODE (op1) == PLUS && GET_CODE (XEXP (op1,1)) == CONST)
+    {
+	    rtx p0, p1, result, temp;
+
+	    p0 = XEXP (XEXP (op1,1), 0);
+
+	    if (GET_CODE (p0) == PLUS)
+	      {
+		    p1 = XEXP (p0, 1);
+		    p0 = XEXP (p0, 0);
+	      }
+
+	    if (GET_CODE (p0) == UNSPEC && GET_CODE (p1) == CONST_INT
+	    	&& flag_pic && TARGET_PIC_DATA_TEXT_REL)
+	      {
+		    result = gen_rtx_CONST (Pmode, p0);
+		    result = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, result);
+		    temp = force_reg (SImode, result);
+		    emit_move_insn (op0, gen_rtx_PLUS (SImode, temp, p1));
+		    return true;
+	      }
+
+    }
   /* Handle Case of (const (plus symbol const_int)).  */
   if (GET_CODE (op1) == CONST && GET_CODE (XEXP (op1,0)) == PLUS)
     {
@@ -3912,6 +4049,9 @@ microblaze_starting_frame_offset (void)
 #undef TARGET_LEGITIMATE_CONSTANT_P
 #define TARGET_LEGITIMATE_CONSTANT_P microblaze_legitimate_constant_p
 
+#undef  TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC
+#define TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC	microblaze_gen_pic_addr_dif_vec
+
 #undef TARGET_MACHINE_DEPENDENT_REORG
 #define TARGET_MACHINE_DEPENDENT_REORG microblaze_machine_dependent_reorg
 
Index: gcc/config/microblaze/microblaze.h
===================================================================
--- gcc/config/microblaze/microblaze.h	(revision 258413)
+++ gcc/config/microblaze/microblaze.h	(working copy)
@@ -518,11 +518,7 @@ typedef struct microblaze_args
 
 /* Identify valid constant addresses.  Exclude if PIC addr which 
    needs scratch register.  */
-#define CONSTANT_ADDRESS_P(X)						\
-  (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF		\
-    || GET_CODE (X) == CONST_INT 		                        \
-    || (GET_CODE (X) == CONST						\
-	&& ! (flag_pic && pic_address_needs_scratch (X))))
+#define CONSTANT_ADDRESS_P(X)	microblaze_constant_address_p(X)
 
 /* Define this, so that when PIC, reload won't try to reload invalid
    addresses which require two reload registers.  */
Index: gcc/config/microblaze/microblaze.md
===================================================================
--- gcc/config/microblaze/microblaze.md	(revision 258413)
+++ gcc/config/microblaze/microblaze.md	(working copy)
@@ -41,6 +41,8 @@
   (UNSPEC_CMP		104)    ;; signed compare
   (UNSPEC_CMPU		105)    ;; unsigned compare
   (UNSPEC_TLS           106)    ;; jump table
+  (UNSPEC_SET_TEXT       107)    ;; set text start
+  (UNSPEC_TEXT       108)    ;; data text relative
 ])
 
 (define_c_enum "unspec" [
@@ -1848,7 +1850,7 @@
   {
     gcc_assert (GET_MODE (operands[0]) == Pmode);
 
-    if (!flag_pic)
+    if (!flag_pic || (flag_pic && TARGET_PIC_DATA_TEXT_REL))
       emit_jump_insn (gen_tablejump_internal1 (operands[0], operands[1]));
     else
       emit_jump_insn (gen_tablejump_internal3 (operands[0], operands[1]));
@@ -2053,7 +2055,8 @@
   {
     rtx addr = XEXP (operands[0], 0);
 
-    if (flag_pic == 2 && GET_CODE (addr) == SYMBOL_REF 
+    if (flag_pic == 2 && !TARGET_PIC_DATA_TEXT_REL
+    && GET_CODE (addr) == SYMBOL_REF
 	&& !SYMBOL_REF_LOCAL_P (addr)) 
       {
         rtx temp = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_PLT);
@@ -2156,7 +2159,8 @@
   {
     rtx addr = XEXP (operands[1], 0);
 
-    if (flag_pic == 2 && GET_CODE (addr) == SYMBOL_REF
+    if (flag_pic == 2 && !TARGET_PIC_DATA_TEXT_REL
+    && GET_CODE (addr) == SYMBOL_REF
 	&& !SYMBOL_REF_LOCAL_P (addr)) 
       {
         rtx temp = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_PLT);
@@ -2313,6 +2317,18 @@
   [(set_attr "type" "multi")
    (set_attr "length" "12")])
 
+;; The insn to set TEXT.
+;; The hardcoded number "8" accounts for $pc difference
+;; between "mfs" and "addik" instructions.
+(define_insn "set_text"
+  [(set (match_operand:SI 0 "register_operand" "=r")
+    (unspec:SI[(const_int 0)] UNSPEC_SET_TEXT))]
+  ""
+  "mfs\t%0,rpc\n\taddik\t%0,%0,8@TXTPCREL"
+  [(set_attr "type" "multi")
+   (set_attr "length" "12")])
+
+
 ;; This insn gives the count of leading number of zeros for the second
 ;; operand and stores the result in first operand.
 (define_insn "clzsi2"
Index: gcc/config/microblaze/microblaze.opt
===================================================================
--- gcc/config/microblaze/microblaze.opt	(revision 258413)
+++ gcc/config/microblaze/microblaze.opt	(working copy)
@@ -127,5 +127,9 @@ mxl-prefetch
 Target Mask(PREFETCH)
 Use hardware prefetch instruction
 
+mpic-data-text-rel
+Target Mask(PIC_DATA_TEXT_REL)
+Data referenced by offset from start of text instead of GOT (with -fPIC/-fPIE).
+
 mxl-mode-xilkernel
 Target
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi	(revision 258413)
+++ gcc/doc/invoke.texi	(working copy)
@@ -866,7 +866,7 @@ Objective-C and Objective-C++ Dialects}.
 @gccoptlist{-msoft-float  -mhard-float  -msmall-divides  -mcpu=@var{cpu} @gol
 -mmemcpy  -mxl-soft-mul  -mxl-soft-div  -mxl-barrel-shift @gol
 -mxl-pattern-compare  -mxl-stack-check  -mxl-gp-opt  -mno-clearbss @gol
--mxl-multiply-high  -mxl-float-convert  -mxl-float-sqrt @gol
+-mxl-multiply-high  -mxl-float-convert  -mxl-float-sqrt -mpic-data-text-rel @gol
 -mbig-endian  -mlittle-endian  -mxl-reorder  -mxl-mode-@var{app-model}}
 
 @emph{MIPS Options}
Index: gcc/doc/tm.texi
===================================================================
--- gcc/doc/tm.texi	(revision 258413)
+++ gcc/doc/tm.texi	(working copy)
@@ -7491,6 +7491,14 @@ when the target cannot support (some kinds of) dyn
 in read-only sections even in executables.
 @end deftypefn
 
+@deftypefn {Target Hook} bool TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC (void)
+Return a flag for either generating ADDR_DIF_VEC table
+or ADDR_VEC table for jumps in case of -fPIC.
+
+The default version of this function returns true if flag_pic
+is equal true and false otherwise
+@end deftypefn
+
 @deftypefn {Target Hook} {section *} TARGET_ASM_SELECT_SECTION (tree @var{exp}, int @var{reloc}, unsigned HOST_WIDE_INT @var{align})
 Return the section into which @var{exp} should be placed.  You can
 assume that @var{exp} is either a @code{VAR_DECL} node or a constant of
Index: gcc/doc/tm.texi.in
===================================================================
--- gcc/doc/tm.texi.in	(revision 258413)
+++ gcc/doc/tm.texi.in	(working copy)
@@ -4922,6 +4922,8 @@ This macro is irrelevant if there is no separate r
 
 @hook TARGET_ASM_RELOC_RW_MASK
 
+@hook TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC
+
 @hook TARGET_ASM_SELECT_SECTION
 
 @defmac USE_SELECT_SECTION_FOR_FUNCTIONS
Index: gcc/stmt.c
===================================================================
--- gcc/stmt.c	(revision 258413)
+++ gcc/stmt.c	(working copy)
@@ -847,7 +847,8 @@ emit_case_dispatch_table (tree index_expr, tree in
   /* Output the table.  */
   emit_label (table_label);
 
-  if (CASE_VECTOR_PC_RELATIVE || flag_pic)
+  if (CASE_VECTOR_PC_RELATIVE
+	  || (flag_pic && targetm.asm_out.generate_pic_addr_diff_vec ()))
     emit_jump_table_data (gen_rtx_ADDR_DIFF_VEC (CASE_VECTOR_MODE,
 						 gen_rtx_LABEL_REF (Pmode,
 								    table_label),
Index: gcc/target.def
===================================================================
--- gcc/target.def	(revision 258413)
+++ gcc/target.def	(working copy)
@@ -507,6 +507,19 @@ in read-only sections even in executables.",
  int, (void),
  default_reloc_rw_mask)
 
+
+ /* Return a flag for either generating ADDR_DIF_VEC table
+ or ADDR_VEC table for jumps in case of -fPIC/-fPIE.  */
+DEFHOOK
+(generate_pic_addr_diff_vec,
+"Return a flag for either generating ADDR_DIF_VEC table\n\
+or ADDR_VEC table for jumps in case of -fPIC.\n\
+\n\
+The default version of this function returns true if flag_pic\n\
+is equal true and false otherwise",
+ bool, (void),
+ default_generate_pic_addr_diff_vec)
+
  /* Return a section for EXP.  It may be a DECL or a constant.  RELOC
     is nonzero if runtime relocations must be applied; bit 1 will be
     set if the runtime relocations require non-local name resolution.
Index: gcc/targhooks.c
===================================================================
--- gcc/targhooks.c	(revision 258413)
+++ gcc/targhooks.c	(working copy)
@@ -1196,6 +1196,15 @@ default_reloc_rw_mask (void)
   return flag_pic ? 3 : 0;
 }
 
+/* By default, address diff vectors are generated
+for jump tables when flag_pic is true.  */
+
+bool
+default_generate_pic_addr_diff_vec (void)
+{
+  return true;
+}
+
 /* By default, do no modification. */
 tree default_mangle_decl_assembler_name (tree decl ATTRIBUTE_UNUSED,
 					 tree id)
Index: gcc/targhooks.h
===================================================================
--- gcc/targhooks.h	(revision 258413)
+++ gcc/targhooks.h	(working copy)
@@ -175,6 +175,7 @@ extern machine_mode default_secondary_memory_neede
 extern void default_target_option_override (void);
 extern void hook_void_bitmap (bitmap);
 extern int default_reloc_rw_mask (void);
+extern bool default_generate_pic_addr_diff_vec (void);
 extern tree default_mangle_decl_assembler_name (tree, tree);
 extern tree default_emutls_var_fields (tree, tree *);
 extern tree default_emutls_var_init (tree, tree, tree);
Index: gcc/testsuite/gcc.target/microblaze/others/data_var1.c
===================================================================
--- gcc/testsuite/gcc.target/microblaze/others/data_var1.c	(revision 258413)
+++ gcc/testsuite/gcc.target/microblaze/others/data_var1.c	(working copy)
@@ -3,6 +3,6 @@ int global;
 
 int testfunc ()
 {
-/* { dg-final { scan-assembler "\lwi\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r0" } } */
+/* { dg-final { scan-assembler "\lwi\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(0|20)" } } */
     return global;
 }
Index: gcc/testsuite/gcc.target/microblaze/others/data_var2.c
===================================================================
--- gcc/testsuite/gcc.target/microblaze/others/data_var2.c	(revision 258413)
+++ gcc/testsuite/gcc.target/microblaze/others/data_var2.c	(working copy)
@@ -3,6 +3,6 @@ int global = 10;
 
 int testfunc ()
 {
-/* { dg-final { scan-assembler "\lwi\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r0" } } */
+/* { dg-final { scan-assembler "\lwi\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(0|20)" } } */
     return global;
 }
Index: gcc/testsuite/gcc.target/microblaze/others/picdtr.c
===================================================================
--- gcc/testsuite/gcc.target/microblaze/others/picdtr.c	(nonexistent)
+++ gcc/testsuite/gcc.target/microblaze/others/picdtr.c	(working copy)
@@ -0,0 +1,80 @@
+/* { dg-options "-fPIE -mpic-data-text-rel -save-temps" } */
+/* { dg-do run } */
+
+#define TEST_VAR(var,val) (var) = (val); if( (var) != (val)) return 0;
+
+int foo(unsigned int i);
+extern void abort(void);
+extern void exit(int);
+
+unsigned char data[8];
+long bigData[7];
+long var;
+typedef struct {int a; short b; long c[1000][1000]; long long d[3][3]; char e; } myDef;
+myDef def;
+const char* myString;
+
+/* { dg-final { scan-assembler "mfs\tr20,rpc" } } */
+/* { dg-final { scan-assembler "addik\tr20,r20,8@TXTPCREL" } } */
+/* { dg-final { scan-assembler ",r20,\[^\n]*var\[^\n]*@TXTREL" } } */
+/* { dg-final { scan-assembler-not ",r0,\[^\n]*var" } } */
+/* { dg-final { scan-assembler ",r20,\[^\n]*bigData\[^\n]*@TXTREL" } } */
+/* { dg-final { scan-assembler-not ",r0,\[^\n]*bigData" } } */
+/* { dg-final { scan-assembler ",r20,\[^\n]*def\[^\n]*@TXTREL" } } */
+/* { dg-final { scan-assembler-not ",r0,\[^\n]*def" } } */
+/* { dg-final { scan-assembler ",r20,\[^\n]*data\[^\n]*@TXTREL" } } */
+/* { dg-final { scan-assembler-not ",r0,\[^\n]*data" } } */
+/* { dg-final { scan-assembler ",r20,\[^\n]*L\[^\n]*@TXTREL" } } */
+/* { dg-final { scan-assembler-not ",r0,\[^\n]*L" } } */
+
+
+
+void foo2() {
+	var++;
+}
+
+int foo (unsigned int i) {
+
+	TEST_VAR(var,123)
+	TEST_VAR(data[i],77)
+	TEST_VAR(data[2],88)
+	TEST_VAR(def.a,897)
+	TEST_VAR(bigData[i],78)
+	TEST_VAR(bigData[2],777)
+	TEST_VAR(def.b,12333);
+	TEST_VAR(def.c[i][i],5);
+	TEST_VAR(def.c[0][1],7);
+	TEST_VAR(def.d[1][2],123);
+	TEST_VAR(def.e,7);
+	TEST_VAR(bigData[i+1],bigData[i*2]);
+
+	foo2();
+
+	myString = "Hello";
+
+	switch(i){
+
+	case 1: var += 2; break;
+	case 2: var += 3; break;
+	case 3: var += 5; break;
+	case 4: var += 7; break;
+	case 5: var += 8; break;
+	default: var = 0;
+
+	}
+
+	return 1;
+
+}
+
+int main() {
+
+	int result = foo(3);
+	if(result != 1 || var != 129) {
+		abort();
+	}
+
+	exit(0);
+
+}
+
Index: gcc/testsuite/gcc.target/microblaze/others/sdata_var1.c
===================================================================
--- gcc/testsuite/gcc.target/microblaze/others/sdata_var1.c	(revision 258413)
+++ gcc/testsuite/gcc.target/microblaze/others/sdata_var1.c	(working copy)
@@ -1,4 +1,4 @@
-/* { dg-options "-mxl-gp-opt" } */
+/* { dg-options "-mxl-gp-opt -fno-pic" } */
 
 /* { dg-final { scan-assembler "\.sbss\[^2]+" } } */
 typedef int Boolean;
Index: gcc/testsuite/gcc.target/microblaze/others/sdata_var2.c
===================================================================
--- gcc/testsuite/gcc.target/microblaze/others/sdata_var2.c	(revision 258413)
+++ gcc/testsuite/gcc.target/microblaze/others/sdata_var2.c	(working copy)
@@ -1,4 +1,4 @@
-/* { dg-options "-mxl-gp-opt" } */
+/* { dg-options "-mxl-gp-opt -fno-pic" } */
 
 /* { dg-final { scan-assembler "\.sdata\[^2]+" } } */
 int global = 10;
Index: gcc/testsuite/gcc.target/microblaze/others/sdata_var3.c
===================================================================
--- gcc/testsuite/gcc.target/microblaze/others/sdata_var3.c	(revision 258413)
+++ gcc/testsuite/gcc.target/microblaze/others/sdata_var3.c	(working copy)
@@ -1,4 +1,4 @@
-/* { dg-options "-mxl-gp-opt" } */
+/* { dg-options "-mxl-gp-opt -fno-pic" } */
 
 extern int a;
 
Index: gcc/testsuite/gcc.target/microblaze/others/sdata_var4.c
===================================================================
--- gcc/testsuite/gcc.target/microblaze/others/sdata_var4.c	(revision 258413)
+++ gcc/testsuite/gcc.target/microblaze/others/sdata_var4.c	(working copy)
@@ -1,4 +1,4 @@
-/* { dg-options "-mxl-gp-opt -G 16" } */
+/* { dg-options "-mxl-gp-opt -G 16 -fno-pic" } */
 
 /* { dg-final { scan-assembler "\.sbss\[^2]+" } } */
 struct test_s {
Index: gcc/testsuite/gcc.target/microblaze/others/sdata_var5.c
===================================================================
--- gcc/testsuite/gcc.target/microblaze/others/sdata_var5.c	(revision 258413)
+++ gcc/testsuite/gcc.target/microblaze/others/sdata_var5.c	(working copy)
@@ -1,4 +1,4 @@
-/* { dg-options "-mxl-gp-opt -G 16" } */
+/* { dg-options "-mxl-gp-opt -G 16 -fno-pic" } */
 
 /* { dg-final { scan-assembler "\.sdata\[^2]+" } } */
 struct test_s {
Index: gcc/testsuite/gcc.target/microblaze/others/sdata_var6.c
===================================================================
--- gcc/testsuite/gcc.target/microblaze/others/sdata_var6.c	(revision 258413)
+++ gcc/testsuite/gcc.target/microblaze/others/sdata_var6.c	(working copy)
@@ -1,5 +1,4 @@
-/* { dg-options "-mxl-gp-opt -G 16" } */
-
+/* { dg-options "-mxl-gp-opt -G 16 -fno-pic" } */
 struct test_s {
     int a;
     int b;
Index: gcc/testsuite/gcc.target/microblaze/others/string_cst1_gpopt.c
===================================================================
--- gcc/testsuite/gcc.target/microblaze/others/string_cst1_gpopt.c	(revision 258413)
+++ gcc/testsuite/gcc.target/microblaze/others/string_cst1_gpopt.c	(working copy)
@@ -1,4 +1,4 @@
-/* { dg-options "-mxl-gp-opt" } */
+/* { dg-options "-mxl-gp-opt -fno-pic" } */
 
 #include <string.h>
 
Index: gcc/testsuite/gcc.target/microblaze/others/string_cst2_gpopt.c
===================================================================
--- gcc/testsuite/gcc.target/microblaze/others/string_cst2_gpopt.c	(revision 258413)
+++ gcc/testsuite/gcc.target/microblaze/others/string_cst2_gpopt.c	(working copy)
@@ -1,4 +1,4 @@
-/* { dg-options "-mxl-gp-opt" } */
+/* { dg-options "-mxl-gp-opt -fno-pic" } */
 
 #include <string.h>
 

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

* Re: [PATCH] [Microblaze]: PIC Data Text Relative
  2018-04-18 12:44                                     ` Andrew Sadek
@ 2018-04-18 16:57                                       ` Michael Eager
  2018-04-19 10:43                                         ` Andrew Sadek
  0 siblings, 1 reply; 27+ messages in thread
From: Michael Eager @ 2018-04-18 16:57 UTC (permalink / raw)
  To: Andrew Sadek; +Cc: gcc-patches, nmekala, Michael Eager



On 04/18/2018 05:44 AM, Andrew Sadek wrote:
> Hello Michael,
> 
> I have attached the patch as well,
> (the same as in :
> https://github.com/andrewsadek/microblaze-pic-data-text-rel/blob/pic_data_text_rel/PATCH_BUNDLE/gcc.patch)
> 
> On Thu, Mar 22, 2018 at 8:37 PM, Andrew Sadek <andrew.sadek.se@gmail.com> wrote:
>> Hello Michael,
>>
>> I have adapted the test cases.
>>
>> Please find the patch below with Change log, description and test results.
>>
>> Description:
>> ------------------
>>
>> This branch is regarding a new implemented feature in GCC Microblaze
>> that allows Position Independent Code to run using Data Text Relative
>> addressing instead of using Global Offset Table.
>>
>> Its aim was to make 'PIC' more efficient and flexible as elf size
>> excess/ performance overhead were noticed when using GOT due to the
>> indirect addressing.
>> The change was tested with the dhrystone benchmark on a real Hardware
>> (Xilinx FPGA Spartan 6) and the test report went successfully for all
>> optimization levels.
>>
>> Indeed, Microblaze does not support PC-relative addressing in Hardware like ARM.
>> The idea was to store the start address of current text section in
>> 'r20' instead of GOT, in the function prologue. Correspondingly, data
>> references will be an offset from the original reference value to the
>> start of text thus being added to the 'r20' base register will resolve
>> the actual address.
>>
>> Henceforth, 2 new relocations have been created:
>> - 'R_MICROBLAZE_TEXTPCREL_64': resolves offset of current PC to start
>> of text in order to set r20
>> - 'R_MICROBLAZE_TEXTREL_64': resolves offset of mentioned data
>> reference to start of text
>>
>> Accordingly, both assembler and linker (binutils) have been adapted.
>>
>> For extra details:
>> https://github.com/andrewsadek/microblaze-pic-data-text-rel/blob/pic_data_text_rel/README.md
>>
>> Change Log:
>> ---------------------
>>
>> 2018-03-22 Andrew Sadek  <andrew.sadek.se@gmail.com>
>>
>>      Microblaze Target: PIC data text relative
>>      * gcc/config/microblaze/microblaze.opt: add new option
>> -mpic-data-text-rel.
>>      * gcc/config/microblaze/microblaze-protos.h (microblaze_constant_address_p):
>>      Add microblaze_constant_address_p function instead of the macro in
>> microblaze.h
>>      * gcc/config/microblaze/microblaze.c (TARGET_PIC_DATA_TEXT_REL):
>> New addressing mode
>>      for data-text relative position indepenedent code.
>>      (microblaze_classify_unspec): add 'UNSPEC_TEXT' case ->
>> 'ADDRESS_SYMBOLIC_TXT_REL'.
>>      (microblaze_classify_address): add handling for UNSPEC + CONST_INT.
>>      (microblaze_legitimate_pic_operand): exclude function calls from
>> pic operands
>>      in case of TARGET_PIC_DATA_TEXT_REL option.
>>      (microblaze_legitimize_address): generate 'UNSPEC_TEXT' for all possible
>>      addresses cases.
>>      (microblaze_address_insns): add 'ADDRESS_SYMBOLIC_TXT_REL' case.
>>      (print_operand): add 'ADDRESS_SYMBOLIC_TXT_REL' case.
>>      (print_operand_address): add 'ADDRESS_SYMBOLIC_TXT_REL' case + handling for
>>      'address + offset'.
>>      (microblaze_expand_prologue): add new function prologue call for
>> 'r20' assignation.
>>      (microblaze_asm_generate_pic_addr_dif_vec): override new target hook
>>     'TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC' to disable address diff vector
>>      table in case of TARGET_PIC_DATA_TEXT_REL.
>>      (expand_pic_symbol_ref): add handling for 'UNSPEC_TEXT'.
>>      * gcc/config/microblaze/microblaze.md (TARGET_PIC_DATA_TEXT_REL):
>> Add new macros 'UNSPEC_TEXT',
>>      'UNSPEC_SET_TEXT' + add rule for setting r20 in function prologue
>> + exclude function calls
>>      from 'UNSPEC_PLT' in case of data text relative mode.
>>      * gcc/doc/tm.texi.in (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC): Add
>> new target hook for generating
>>      address diff vector tables in case of flag_pic.
>>      * gcc/doc/tm.texi : Regenerate.
>>      * gcc/stmt.c (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC): append new condition
>>      'targetm.asm_out.generate_pic_addr_diff_vec' to flag_pic in case
>> of addr diff vector generation.
>>      * gcc/target.def (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC): add
>> target hook definition.
>>      * gcc/targhooks.h, gcc/targhooks.c (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC):
>>      add default function for generate_pic_addr_diff_vec -> flag_pic.
>>      * gcc/doc/invoke.texi (Add new pic option): Add new microblaze pic
>> option for data text relative.

Hi Andrew --

Check indents in the following files:
(Make sure that your tabs are set at 8 chars.)
--- gcc/config/microblaze/microblaze.c	
--- gcc/config/microblaze/microblaze.md	

Just a couple coding notes:

microblaze.c:

@@ -858,6 +879,16 @@ microblaze_classify_address (struct microblaze_add
+		&& strict == 2)

Include comment in function header describing meaning of strict == 2.


@@ -1022,7 +1065,7 @@ microblaze_legitimize_address (rtx x, rtx oldx ATT
       else if (flag_pic == 2 && !TARGET_PIC_DATA_TEXT_REL)
         {
           ...
         }
       else if (flag_pic == 2 && TARGET_PIC_DATA_TEXT_REL)
         {
           ...
         }

It's better to factor this into
      else if (flag_pic == 2)
        {
          if (TARGET_PIC_DATA_TEXT_REL)
            {
              ...
            }
          else
            {
              ...
            }
        }

microblaze.md:

@@ -1848,7 +1850,7 @@

+    if (!flag_pic || (flag_pic && TARGET_PIC_DATA_TEXT_REL))

Test for flag_pic is redundant.  This can be

+    if (!flag_pic || TARGET_PIC_DATA_TEXT_REL)

doc/invoke.texi:
-mpic-data-text-rel -- include description
Is this different from -mpic-data-is-text-relative?
(Yes, that's a bit of a wordy option.)

doc/tm.texi:
+Return a flag for either generating ADDR_DIF_VEC table
+or ADDR_VEC table for jumps in case of -fPIC.

Explicitly state what true or false means.

target.def:

+(generate_pic_addr_diff_vec,

Explicitly state what true or false means.

targhooks.c:

+bool
+default_generate_pic_addr_diff_vec (void)
+{
+  return true;
+}

This doesn't appear to match the description in target.def.



-- 
Michael Eager    eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306

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

* Re: [PATCH] [Microblaze]: PIC Data Text Relative
  2018-04-18 16:57                                       ` Michael Eager
@ 2018-04-19 10:43                                         ` Andrew Sadek
  2018-04-27  1:41                                           ` Michael Eager
  0 siblings, 1 reply; 27+ messages in thread
From: Andrew Sadek @ 2018-04-19 10:43 UTC (permalink / raw)
  To: Michael Eager; +Cc: gcc-patches, nmekala, Michael Eager

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

On Wed, Apr 18, 2018 at 6:57 PM, Michael Eager <eager@eagercon.com> wrote:
>
> Hi Andrew --
>
> Check indents in the following files:
> (Make sure that your tabs are set at 8 chars.)
> --- gcc/config/microblaze/microblaze.c
> --- gcc/config/microblaze/microblaze.md
>
I have re-run check_GNU_Style.sh and no are issues are found now.

> Just a couple coding notes:
>
> microblaze.c:
>
> @@ -858,6 +879,16 @@ microblaze_classify_address (struct microblaze_add
> +               && strict == 2)
>
> Include comment in function header describing meaning of strict == 2.

Done

>
> @@ -1022,7 +1065,7 @@ microblaze_legitimize_address (rtx x, rtx oldx ATT
>       else if (flag_pic == 2 && !TARGET_PIC_DATA_TEXT_REL)
>         {
>           ...
>         }
>       else if (flag_pic == 2 && TARGET_PIC_DATA_TEXT_REL)
>         {
>           ...
>         }
>
> It's better to factor this into
>      else if (flag_pic == 2)
>        {
>          if (TARGET_PIC_DATA_TEXT_REL)
>            {
>              ...
>            }
>          else
>            {
>              ...
>            }
>        }
>

Done

> microblaze.md:
>
> @@ -1848,7 +1850,7 @@
>
> +    if (!flag_pic || (flag_pic && TARGET_PIC_DATA_TEXT_REL))
>
> Test for flag_pic is redundant.  This can be
>
> +    if (!flag_pic || TARGET_PIC_DATA_TEXT_REL)

Done

> doc/invoke.texi:
> -mpic-data-text-rel -- include description
> Is this different from -mpic-data-is-text-relative?
> (Yes, that's a bit of a wordy option.)

Changed the name and added description, now it's like ARM's option

> doc/tm.texi:
> +Return a flag for either generating ADDR_DIF_VEC table
> +or ADDR_VEC table for jumps in case of -fPIC.
>
> Explicitly state what true or false means.

Done

> target.def:
>
> +(generate_pic_addr_diff_vec,
>
> Explicitly state what true or false means.

Done

> targhooks.c:
>
> +bool
> +default_generate_pic_addr_diff_vec (void)
> +{
> +  return true;
> +}
>
> This doesn't appear to match the description in target.def.
>

Adapted

>
> --
> Michael Eager    eager@eagercon.com
>
> 1960 Park Blvd., Palo Alto, CA 94306

Please find patch attached
and also in (https://github.com/andrewsadek/microblaze-pic-data-text-rel/blob/pic_data_text_rel/PATCH_BUNDLE/gcc.patch)

-- 

Andrew

[-- Attachment #2: gcc.patch.txt --]
[-- Type: text/plain, Size: 28099 bytes --]

Index: gcc/config/microblaze/microblaze-protos.h
===================================================================
--- gcc/config/microblaze/microblaze-protos.h	(revision 258312)
+++ gcc/config/microblaze/microblaze-protos.h	(working copy)
@@ -24,6 +24,7 @@
 
 #ifdef RTX_CODE
 extern int pic_address_needs_scratch (rtx);
+extern bool microblaze_constant_address_p (rtx x);
 extern void expand_block_move        (rtx *);
 extern void microblaze_expand_prologue (void);
 extern void microblaze_expand_epilogue (void);
Index: gcc/config/microblaze/microblaze.c
===================================================================
--- gcc/config/microblaze/microblaze.c	(revision 258312)
+++ gcc/config/microblaze/microblaze.c	(working copy)
@@ -91,7 +91,8 @@ enum microblaze_address_type
   ADDRESS_SYMBOLIC,
   ADDRESS_GOTOFF,
   ADDRESS_PLT,
-  ADDRESS_TLS
+  ADDRESS_TLS,
+  ADDRESS_SYMBOLIC_TXT_REL
 };
 
 /* Classifies symbols
@@ -650,6 +651,10 @@ microblaze_classify_unspec (struct microblaze_addr
       info->type = ADDRESS_TLS;
       info->tls_type = tls_reloc (INTVAL (XVECEXP (x, 0, 1)));
     }
+  else if (XINT (x, 1) == UNSPEC_TEXT)
+    {
+	  info->type = ADDRESS_SYMBOLIC_TXT_REL;
+    }
   else
     {
       return false;
@@ -701,8 +706,10 @@ get_base_reg (rtx x)
 }
 
 /* Return true if X is a valid address for machine mode MODE.  If it is,
-   fill in INFO appropriately.  STRICT is true if we should only accept
-   hard base registers.  
+   fill in INFO appropriately.
+   STRICT > 0 if we should only accept hard base registers.
+   STRICT = 2 if the operand address is being printed thus
+   function has been called by print_operand_address.
 
       type                     regA      regB    offset      symbol
 
@@ -728,6 +735,7 @@ microblaze_classify_address (struct microblaze_add
 {
   rtx xplus0;
   rtx xplus1;
+  rtx offset;
 
   info->type = ADDRESS_INVALID;
   info->regA = NULL;
@@ -735,6 +743,7 @@ microblaze_classify_address (struct microblaze_add
   info->offset = NULL;
   info->symbol = NULL;
   info->symbol_type = SYMBOL_TYPE_INVALID;
+  offset = NULL;
 
   switch (GET_CODE (x))
     {
@@ -795,9 +804,14 @@ microblaze_classify_address (struct microblaze_add
 		/* for (plus x const_int) just look at x.  */
 		if (GET_CODE (xconst0) == PLUS
 		    && GET_CODE (XEXP (xconst0, 1)) == CONST_INT
-		    && SMALL_INT (XEXP (xconst0, 1)))
+		    && (SMALL_INT (XEXP (xconst0, 1))
+		       || GET_CODE (XEXP (xconst0, 0)) == UNSPEC))
 		  {
-		    /* This is ok as info->symbol is set to xplus1 the full
+			 /* Hold CONST_INT Value in offset in case of
+		       UNSPEC + CONST_INT.  */
+			offset = XEXP (xconst0, 1);
+
+			/* This is ok as info->symbol is set to xplus1 the full
 		       const-expression below.  */
 		    xconst0 = XEXP (xconst0, 0);
 		  }
@@ -814,6 +828,15 @@ microblaze_classify_address (struct microblaze_add
 		    return true;
 		  }
 
+		if (GET_CODE (xconst0) == UNSPEC && TARGET_PIC_DATA_TEXT_REL)
+		  {
+		    if (GET_MODE_SIZE (mode) > UNITS_PER_WORD)
+		      return false;
+
+		    info->offset = offset;
+		    return microblaze_classify_unspec (info, xconst0);
+		  }
+
 		/* Not base + symbol || base + UNSPEC.  */
 		return false;
 
@@ -858,6 +881,16 @@ microblaze_classify_address (struct microblaze_add
 	     return !(flag_pic && pic_address_needs_scratch (x));
 	  }
 
+	/* Avoid error in print_operand_address in case UNSPEC
+	 is removed from SYMBOL or LABEL REFS during optimization.  */
+	if ((GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF)
+		&& flag_pic && TARGET_PIC_DATA_TEXT_REL
+		&& strict == 2)
+	  {
+	    info->type = ADDRESS_SYMBOLIC_TXT_REL;
+	    return true;
+	  }
+
 	if (flag_pic == 2)
 	  return false;
 	else if (microblaze_tls_symbol_p(x))
@@ -891,8 +924,18 @@ microblaze_legitimate_address_p (machine_mode mode
   struct microblaze_address_info addr;
 
   return microblaze_classify_address (&addr, x, mode, strict);
+
 }
 
+bool
+microblaze_constant_address_p (rtx x)
+{
+  return ((GET_CODE (x) == LABEL_REF) || (GET_CODE (x) == SYMBOL_REF)
+		  || GET_CODE (x) == CONST_INT
+		  || (GET_CODE (x) == CONST
+		  && ! (flag_pic && pic_address_needs_scratch (x))));
+}
+
 int
 microblaze_valid_pic_const (rtx x)
 {
@@ -910,9 +953,11 @@ microblaze_valid_pic_const (rtx x)
 int
 microblaze_legitimate_pic_operand (rtx x)
 {
-  if (flag_pic == 2 && (symbol_mentioned_p(x) || label_mentioned_p(x)))
+  if (flag_pic == 2 && (symbol_mentioned_p (x) || label_mentioned_p (x))
+      && !(TARGET_PIC_DATA_TEXT_REL && call_insn_operand (x,VOIDmode)))
     return 0;
 
+
   if (microblaze_tls_referenced_p(x))
     return 0;
 
@@ -1023,19 +1068,37 @@ microblaze_legitimize_address (rtx x, rtx oldx ATT
 		  return result;
 		}
 	      else if (flag_pic == 2)
-		{
-		  rtx pic_ref, reg;
-		  reg = gen_reg_rtx (Pmode);
+		    {
+		      if (!TARGET_PIC_DATA_TEXT_REL)
+			    {
+			      rtx pic_ref, reg;
+			      reg = gen_reg_rtx (Pmode);
 
-		  pic_ref = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, xplus1),
-					    UNSPEC_GOTOFF);
-		  pic_ref = gen_rtx_CONST (Pmode, pic_ref);
-		  pic_ref = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, pic_ref);
-		  pic_ref = gen_const_mem (Pmode, pic_ref);
-		  emit_move_insn (reg, pic_ref);
-		  result = gen_rtx_PLUS (Pmode, xplus0, reg);
-		  return result;
-		}
+			      pic_ref = gen_rtx_UNSPEC (Pmode,
+					      gen_rtvec (1, xplus1),
+					      UNSPEC_GOTOFF);
+			      pic_ref = gen_rtx_CONST (Pmode, pic_ref);
+			      pic_ref = gen_rtx_PLUS (Pmode,
+					      pic_offset_table_rtx, pic_ref);
+			      pic_ref = gen_const_mem (Pmode, pic_ref);
+			      emit_move_insn (reg, pic_ref);
+			      result = gen_rtx_PLUS (Pmode, xplus0, reg);
+			      return result;
+			    }
+		      else
+			    {
+			      rtx pic_ref, reg;
+			      reg = gen_reg_rtx (Pmode);
+			      pic_ref = gen_rtx_UNSPEC (Pmode,
+					      gen_rtvec (1, xplus1),
+					      UNSPEC_TEXT);
+			      pic_ref = gen_rtx_CONST (Pmode, pic_ref);
+			      emit_insn (gen_addsi3 (reg,
+					      pic_offset_table_rtx, xplus0));
+			      result = gen_rtx_PLUS (Pmode, reg, pic_ref);
+			      return result;
+			    }
+		    }
 	    }
 	}
     }
@@ -1047,7 +1110,7 @@ microblaze_legitimize_address (rtx x, rtx oldx ATT
         {
           reg = microblaze_legitimize_tls_address (xinsn, NULL_RTX);
         }
-      else
+      else if (flag_pic == 2 && !TARGET_PIC_DATA_TEXT_REL)
         {
           rtx pic_ref;
 
@@ -1060,6 +1123,19 @@ microblaze_legitimize_address (rtx x, rtx oldx ATT
           pic_ref = gen_const_mem (Pmode, pic_ref);
           reg = pic_ref;
         }
+      else if (flag_pic == 2 && TARGET_PIC_DATA_TEXT_REL)
+	    {
+    	  rtx pic_ref;
+
+    	  if (reload_in_progress)
+    		  df_set_regs_ever_live (PIC_OFFSET_TABLE_REGNUM, true);
+
+    	  pic_ref = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, xinsn), UNSPEC_TEXT);
+    	  pic_ref = gen_rtx_CONST (Pmode, pic_ref);
+    	  pic_ref = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, pic_ref);
+    	  reg = pic_ref;
+
+	    }
       return reg;
     }
 
@@ -1388,6 +1464,7 @@ microblaze_address_insns (rtx x, machine_mode mode
 	case ADDRESS_REG_INDEX:
 	  return 1;
 	case ADDRESS_SYMBOLIC:
+	case ADDRESS_SYMBOLIC_TXT_REL:
 	case ADDRESS_GOTOFF:
 	  return 2;
 	case ADDRESS_TLS:
@@ -2066,7 +2143,7 @@ compute_frame_size (HOST_WIDE_INT size)
 
   total_size = var_size + args_size;
 
-  if (flag_pic == 2)
+  if (flag_pic == 2 && !TARGET_PIC_DATA_TEXT_REL)
     /* force setting GOT.  */
     df_set_regs_ever_live (MB_ABI_PIC_ADDR_REGNUM, true);
 
@@ -2322,6 +2399,7 @@ print_operand (FILE * file, rtx op, int letter)
 	    case ADDRESS_REG:
 	    case ADDRESS_CONST_INT:
 	    case ADDRESS_SYMBOLIC:
+	    case ADDRESS_SYMBOLIC_TXT_REL:
 	    case ADDRESS_GOTOFF:
 	    case ADDRESS_TLS:
 	      fputs ("i", file);
@@ -2489,7 +2567,7 @@ print_operand_address (FILE * file, rtx addr)
 {
   struct microblaze_address_info info;
   enum microblaze_address_type type;
-  if (!microblaze_classify_address (&info, addr, GET_MODE (addr), 1))
+  if (!microblaze_classify_address (&info, addr, GET_MODE (addr), 2))
     fatal_insn ("insn contains an invalid address !", addr);
 
   type = info.type;
@@ -2515,6 +2593,7 @@ print_operand_address (FILE * file, rtx addr)
       output_addr_const (file, info.offset);
       break;
     case ADDRESS_SYMBOLIC:
+    case ADDRESS_SYMBOLIC_TXT_REL:
     case ADDRESS_GOTOFF:
     case ADDRESS_PLT:
     case ADDRESS_TLS:
@@ -2529,6 +2608,16 @@ print_operand_address (FILE * file, rtx addr)
 	{
 	  fputs ("@PLT", file);
 	}
+      else if (type == ADDRESS_SYMBOLIC_TXT_REL)
+    {
+      if (info.offset != NULL && CONST_INT_P (info.offset)
+	      && INTVAL (info.offset) > 0)
+    	{
+    	  fprintf (file, "+");
+    	  output_addr_const (file, info.offset);
+    	}
+      fputs ("@TXTREL", file);
+    }
       else if (type == ADDRESS_TLS)
 	{
 	  switch (info.tls_type)
@@ -2960,8 +3049,19 @@ microblaze_expand_prologue (void)
   if ((flag_pic == 2 || TLS_NEEDS_GOT )
       && df_regs_ever_live_p (MB_ABI_PIC_ADDR_REGNUM))
     {
-      SET_REGNO (pic_offset_table_rtx, MB_ABI_PIC_ADDR_REGNUM);
-      emit_insn (gen_set_got (pic_offset_table_rtx));	/* setting GOT.  */
+	  if ((flag_pic == 2 && !TARGET_PIC_DATA_TEXT_REL) || TLS_NEEDS_GOT)
+	    {
+		  SET_REGNO (pic_offset_table_rtx, MB_ABI_PIC_ADDR_REGNUM);
+		  /* setting GOT.  */
+		  emit_insn (gen_set_got (pic_offset_table_rtx));
+	    }
+      else
+	    {
+    	  SET_REGNO (pic_offset_table_rtx, MB_ABI_PIC_ADDR_REGNUM);
+       	  /* setting start of text.  */
+		  emit_insn (gen_set_text (pic_offset_table_rtx));
+
+	    }
     }
 
   /* If we are profiling, make sure no instructions are scheduled before
@@ -3154,7 +3254,15 @@ microblaze_elf_in_small_data_p (const_tree decl)
   return (size > 0 && size <= microblaze_section_threshold);
 }
 
+/* We need to disable address diff vectors in
+case of pic data text relative mode.  */
 
+static bool
+microblaze_gen_pic_addr_dif_vec (void)
+{
+  return (flag_pic && !TARGET_PIC_DATA_TEXT_REL);
+}
+
 static section *
 microblaze_select_section (tree decl, int reloc, unsigned HOST_WIDE_INT align)
 {
@@ -3187,10 +3295,19 @@ static rtx
 expand_pic_symbol_ref (machine_mode mode ATTRIBUTE_UNUSED, rtx op)
 {
   rtx result;
-  result = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, op), UNSPEC_GOTOFF);
+  bool isFunc = (GET_CODE (op) == SYMBOL_REF
+			     && (SYMBOL_REF_FLAGS (op) & SYMBOL_FLAG_FUNCTION));
+  result = (!TARGET_PIC_DATA_TEXT_REL)
+		  ? gen_rtx_UNSPEC (Pmode, gen_rtvec (1, op), UNSPEC_GOTOFF):
+		   gen_rtx_UNSPEC (Pmode, gen_rtvec (1, op), UNSPEC_TEXT);
   result = gen_rtx_CONST (Pmode, result);
-  result = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, result);
-  result = gen_const_mem (Pmode, result);
+  result = (TARGET_PIC_DATA_TEXT_REL && isFunc)
+		  ? gen_rtx_PLUS (Pmode, gen_raw_REG (Pmode,
+		    get_base_reg (op)), result):
+			gen_rtx_PLUS (Pmode, pic_offset_table_rtx, result);
+  result = (!TARGET_PIC_DATA_TEXT_REL)
+		  ? gen_const_mem (Pmode, result) : result;
+
   return result;
 }
 
@@ -3294,10 +3411,38 @@ microblaze_expand_move (machine_mode mode, rtx ope
 	  if (reload_in_progress)
 	    df_set_regs_ever_live (PIC_OFFSET_TABLE_REGNUM, true);
 	  result = expand_pic_symbol_ref (mode, op1);
+
+	  if (TARGET_PIC_DATA_TEXT_REL && GET_CODE (op0) == REG
+	      && REGNO (op0) >= FIRST_PSEUDO_REGISTER)
+		    result = force_reg (SImode, result);
+
 	  emit_move_insn (op0, result);
 	  return true;
 	}
     }
+  if (GET_CODE (op1) == PLUS && GET_CODE (XEXP (op1,1)) == CONST)
+    {
+	    rtx p0, p1, result, temp;
+
+	    p0 = XEXP (XEXP (op1,1), 0);
+
+	    if (GET_CODE (p0) == PLUS)
+	      {
+		    p1 = XEXP (p0, 1);
+		    p0 = XEXP (p0, 0);
+	      }
+
+	    if (GET_CODE (p0) == UNSPEC && GET_CODE (p1) == CONST_INT
+	    	&& flag_pic && TARGET_PIC_DATA_TEXT_REL)
+	      {
+		    result = gen_rtx_CONST (Pmode, p0);
+		    result = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, result);
+		    temp = force_reg (SImode, result);
+		    emit_move_insn (op0, gen_rtx_PLUS (SImode, temp, p1));
+		    return true;
+	      }
+
+    }
   /* Handle Case of (const (plus symbol const_int)).  */
   if (GET_CODE (op1) == CONST && GET_CODE (XEXP (op1,0)) == PLUS)
     {
@@ -3912,6 +4057,9 @@ microblaze_starting_frame_offset (void)
 #undef TARGET_LEGITIMATE_CONSTANT_P
 #define TARGET_LEGITIMATE_CONSTANT_P microblaze_legitimate_constant_p
 
+#undef  TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC
+#define TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC	microblaze_gen_pic_addr_dif_vec
+
 #undef TARGET_MACHINE_DEPENDENT_REORG
 #define TARGET_MACHINE_DEPENDENT_REORG microblaze_machine_dependent_reorg
 
Index: gcc/config/microblaze/microblaze.h
===================================================================
--- gcc/config/microblaze/microblaze.h	(revision 258312)
+++ gcc/config/microblaze/microblaze.h	(working copy)
@@ -518,11 +518,7 @@ typedef struct microblaze_args
 
 /* Identify valid constant addresses.  Exclude if PIC addr which 
    needs scratch register.  */
-#define CONSTANT_ADDRESS_P(X)						\
-  (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF		\
-    || GET_CODE (X) == CONST_INT 		                        \
-    || (GET_CODE (X) == CONST						\
-	&& ! (flag_pic && pic_address_needs_scratch (X))))
+#define CONSTANT_ADDRESS_P(X)	microblaze_constant_address_p(X)
 
 /* Define this, so that when PIC, reload won't try to reload invalid
    addresses which require two reload registers.  */
Index: gcc/config/microblaze/microblaze.md
===================================================================
--- gcc/config/microblaze/microblaze.md	(revision 258312)
+++ gcc/config/microblaze/microblaze.md	(working copy)
@@ -41,6 +41,8 @@
   (UNSPEC_CMP		104)    ;; signed compare
   (UNSPEC_CMPU		105)    ;; unsigned compare
   (UNSPEC_TLS           106)    ;; jump table
+  (UNSPEC_SET_TEXT       107)    ;; set text start
+  (UNSPEC_TEXT       108)    ;; data text relative
 ])
 
 (define_c_enum "unspec" [
@@ -1848,7 +1850,7 @@
   {
     gcc_assert (GET_MODE (operands[0]) == Pmode);
 
-    if (!flag_pic)
+    if (!flag_pic || TARGET_PIC_DATA_TEXT_REL)
       emit_jump_insn (gen_tablejump_internal1 (operands[0], operands[1]));
     else
       emit_jump_insn (gen_tablejump_internal3 (operands[0], operands[1]));
@@ -2053,7 +2055,8 @@
   {
     rtx addr = XEXP (operands[0], 0);
 
-    if (flag_pic == 2 && GET_CODE (addr) == SYMBOL_REF 
+    if (flag_pic == 2 && !TARGET_PIC_DATA_TEXT_REL
+    && GET_CODE (addr) == SYMBOL_REF
 	&& !SYMBOL_REF_LOCAL_P (addr)) 
       {
         rtx temp = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_PLT);
@@ -2156,7 +2159,8 @@
   {
     rtx addr = XEXP (operands[1], 0);
 
-    if (flag_pic == 2 && GET_CODE (addr) == SYMBOL_REF
+    if (flag_pic == 2 && !TARGET_PIC_DATA_TEXT_REL
+    && GET_CODE (addr) == SYMBOL_REF
 	&& !SYMBOL_REF_LOCAL_P (addr)) 
       {
         rtx temp = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_PLT);
@@ -2313,6 +2317,18 @@
   [(set_attr "type" "multi")
    (set_attr "length" "12")])
 
+;; The insn to set TEXT.
+;; The hardcoded number "8" accounts for $pc difference
+;; between "mfs" and "addik" instructions.
+(define_insn "set_text"
+  [(set (match_operand:SI 0 "register_operand" "=r")
+    (unspec:SI[(const_int 0)] UNSPEC_SET_TEXT))]
+  ""
+  "mfs\t%0,rpc\n\taddik\t%0,%0,8@TXTPCREL"
+  [(set_attr "type" "multi")
+   (set_attr "length" "12")])
+
+
 ;; This insn gives the count of leading number of zeros for the second
 ;; operand and stores the result in first operand.
 (define_insn "clzsi2"
Index: gcc/config/microblaze/microblaze.opt
===================================================================
--- gcc/config/microblaze/microblaze.opt	(revision 258312)
+++ gcc/config/microblaze/microblaze.opt	(working copy)
@@ -127,5 +127,9 @@ mxl-prefetch
 Target Mask(PREFETCH)
 Use hardware prefetch instruction
 
+mpic-data-is-text-relative
+Target Mask(PIC_DATA_TEXT_REL)
+Data referenced by offset from start of text instead of GOT (with -fPIC/-fPIE).
+
 mxl-mode-xilkernel
 Target
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi	(revision 258312)
+++ gcc/doc/invoke.texi	(working copy)
@@ -867,7 +867,8 @@ Objective-C and Objective-C++ Dialects}.
 -mmemcpy  -mxl-soft-mul  -mxl-soft-div  -mxl-barrel-shift @gol
 -mxl-pattern-compare  -mxl-stack-check  -mxl-gp-opt  -mno-clearbss @gol
 -mxl-multiply-high  -mxl-float-convert  -mxl-float-sqrt @gol
--mbig-endian  -mlittle-endian  -mxl-reorder  -mxl-mode-@var{app-model}}
+-mbig-endian  -mlittle-endian  -mxl-reorder  -mxl-mode-@var{app-model}
+-mpic-data-is-text-relative}
 
 @emph{MIPS Options}
 @gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch} @gol
@@ -20095,6 +20096,12 @@ Select application model @var{app-model}.  Valid m
 @item executable
 normal executable (default), uses startup code @file{crt0.o}.
 
+@item -mpic-data-is-text-relative
+@opindex mpic-data-is-text-relative
+Assume that the displacement between the text and data segments is fixed
+at static link time.  This allows data to be referenced by offset from start of
+text address instead of GOT since PC-relative addressing is not supported.
+
 @item xmdstub
 for use with Xilinx Microprocessor Debugger (XMD) based
 software intrusive debug agent called xmdstub. This uses startup file
Index: gcc/doc/tm.texi
===================================================================
--- gcc/doc/tm.texi	(revision 258312)
+++ gcc/doc/tm.texi	(working copy)
@@ -7491,6 +7491,14 @@ when the target cannot support (some kinds of) dyn
 in read-only sections even in executables.
 @end deftypefn
 
+@deftypefn {Target Hook} bool TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC (void)
+Return true to generate ADDR_DIF_VEC table
+or false to generate ADDR_VEC table for jumps in case of -fPIC.
+
+The default version of this function returns true if flag_pic
+equals true and false otherwise
+@end deftypefn
+
 @deftypefn {Target Hook} {section *} TARGET_ASM_SELECT_SECTION (tree @var{exp}, int @var{reloc}, unsigned HOST_WIDE_INT @var{align})
 Return the section into which @var{exp} should be placed.  You can
 assume that @var{exp} is either a @code{VAR_DECL} node or a constant of
Index: gcc/doc/tm.texi.in
===================================================================
--- gcc/doc/tm.texi.in	(revision 258312)
+++ gcc/doc/tm.texi.in	(working copy)
@@ -4922,6 +4922,8 @@ This macro is irrelevant if there is no separate r
 
 @hook TARGET_ASM_RELOC_RW_MASK
 
+@hook TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC
+
 @hook TARGET_ASM_SELECT_SECTION
 
 @defmac USE_SELECT_SECTION_FOR_FUNCTIONS
Index: gcc/stmt.c
===================================================================
--- gcc/stmt.c	(revision 258312)
+++ gcc/stmt.c	(working copy)
@@ -847,7 +847,8 @@ emit_case_dispatch_table (tree index_expr, tree in
   /* Output the table.  */
   emit_label (table_label);
 
-  if (CASE_VECTOR_PC_RELATIVE || flag_pic)
+  if (CASE_VECTOR_PC_RELATIVE
+	  || (flag_pic && targetm.asm_out.generate_pic_addr_diff_vec ()))
     emit_jump_table_data (gen_rtx_ADDR_DIFF_VEC (CASE_VECTOR_MODE,
 						 gen_rtx_LABEL_REF (Pmode,
 								    table_label),
Index: gcc/target.def
===================================================================
--- gcc/target.def	(revision 258312)
+++ gcc/target.def	(working copy)
@@ -507,6 +507,19 @@ in read-only sections even in executables.",
  int, (void),
  default_reloc_rw_mask)
 
+
+ /* Return a flag for either generating ADDR_DIF_VEC table
+ or ADDR_VEC table for jumps in case of -fPIC/-fPIE.  */
+DEFHOOK
+(generate_pic_addr_diff_vec,
+"Return true to generate ADDR_DIF_VEC table\n\
+or false to generate ADDR_VEC table for jumps in case of -fPIC.\n\
+\n\
+The default version of this function returns true if flag_pic\n\
+equals true and false otherwise",
+ bool, (void),
+ default_generate_pic_addr_diff_vec)
+
  /* Return a section for EXP.  It may be a DECL or a constant.  RELOC
     is nonzero if runtime relocations must be applied; bit 1 will be
     set if the runtime relocations require non-local name resolution.
Index: gcc/targhooks.c
===================================================================
--- gcc/targhooks.c	(revision 258312)
+++ gcc/targhooks.c	(working copy)
@@ -1196,6 +1196,15 @@ default_reloc_rw_mask (void)
   return flag_pic ? 3 : 0;
 }
 
+/* By default, address diff vectors are generated
+for jump tables when flag_pic is true.  */
+
+bool
+default_generate_pic_addr_diff_vec (void)
+{
+  return flag_pic;
+}
+
 /* By default, do no modification. */
 tree default_mangle_decl_assembler_name (tree decl ATTRIBUTE_UNUSED,
 					 tree id)
Index: gcc/targhooks.h
===================================================================
--- gcc/targhooks.h	(revision 258312)
+++ gcc/targhooks.h	(working copy)
@@ -175,6 +175,7 @@ extern machine_mode default_secondary_memory_neede
 extern void default_target_option_override (void);
 extern void hook_void_bitmap (bitmap);
 extern int default_reloc_rw_mask (void);
+extern bool default_generate_pic_addr_diff_vec (void);
 extern tree default_mangle_decl_assembler_name (tree, tree);
 extern tree default_emutls_var_fields (tree, tree *);
 extern tree default_emutls_var_init (tree, tree, tree);
Index: gcc/testsuite/gcc.target/microblaze/others/data_var1.c
===================================================================
--- gcc/testsuite/gcc.target/microblaze/others/data_var1.c	(revision 258312)
+++ gcc/testsuite/gcc.target/microblaze/others/data_var1.c	(working copy)
@@ -3,6 +3,6 @@ int global;
 
 int testfunc ()
 {
-/* { dg-final { scan-assembler "\lwi\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r0" } } */
+/* { dg-final { scan-assembler "\lwi\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(0|20)" } } */
     return global;
 }
Index: gcc/testsuite/gcc.target/microblaze/others/data_var2.c
===================================================================
--- gcc/testsuite/gcc.target/microblaze/others/data_var2.c	(revision 258312)
+++ gcc/testsuite/gcc.target/microblaze/others/data_var2.c	(working copy)
@@ -3,6 +3,6 @@ int global = 10;
 
 int testfunc ()
 {
-/* { dg-final { scan-assembler "\lwi\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r0" } } */
+/* { dg-final { scan-assembler "\lwi\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(0|20)" } } */
     return global;
 }
Index: gcc/testsuite/gcc.target/microblaze/others/picdtr.c
===================================================================
--- gcc/testsuite/gcc.target/microblaze/others/picdtr.c	(nonexistent)
+++ gcc/testsuite/gcc.target/microblaze/others/picdtr.c	(working copy)
@@ -0,0 +1,80 @@
+/* { dg-options "-fPIE -mpic-data-text-rel -save-temps" } */
+/* { dg-do run } */
+
+#define TEST_VAR(var,val) (var) = (val); if( (var) != (val)) return 0;
+
+int foo(unsigned int i);
+extern void abort(void);
+extern void exit(int);
+
+unsigned char data[8];
+long bigData[7];
+long var;
+typedef struct {int a; short b; long c[1000][1000]; long long d[3][3]; char e; } myDef;
+myDef def;
+const char* myString;
+
+/* { dg-final { scan-assembler "mfs\tr20,rpc" } } */
+/* { dg-final { scan-assembler "addik\tr20,r20,8@TXTPCREL" } } */
+/* { dg-final { scan-assembler ",r20,\[^\n]*var\[^\n]*@TXTREL" } } */
+/* { dg-final { scan-assembler-not ",r0,\[^\n]*var" } } */
+/* { dg-final { scan-assembler ",r20,\[^\n]*bigData\[^\n]*@TXTREL" } } */
+/* { dg-final { scan-assembler-not ",r0,\[^\n]*bigData" } } */
+/* { dg-final { scan-assembler ",r20,\[^\n]*def\[^\n]*@TXTREL" } } */
+/* { dg-final { scan-assembler-not ",r0,\[^\n]*def" } } */
+/* { dg-final { scan-assembler ",r20,\[^\n]*data\[^\n]*@TXTREL" } } */
+/* { dg-final { scan-assembler-not ",r0,\[^\n]*data" } } */
+/* { dg-final { scan-assembler ",r20,\[^\n]*L\[^\n]*@TXTREL" } } */
+/* { dg-final { scan-assembler-not ",r0,\[^\n]*L" } } */
+
+
+
+void foo2() {
+	var++;
+}
+
+int foo (unsigned int i) {
+
+	TEST_VAR(var,123)
+	TEST_VAR(data[i],77)
+	TEST_VAR(data[2],88)
+	TEST_VAR(def.a,897)
+	TEST_VAR(bigData[i],78)
+	TEST_VAR(bigData[2],777)
+	TEST_VAR(def.b,12333);
+	TEST_VAR(def.c[i][i],5);
+	TEST_VAR(def.c[0][1],7);
+	TEST_VAR(def.d[1][2],123);
+	TEST_VAR(def.e,7);
+	TEST_VAR(bigData[i+1],bigData[i*2]);
+
+	foo2();
+
+	myString = "Hello";
+
+	switch(i){
+
+	case 1: var += 2; break;
+	case 2: var += 3; break;
+	case 3: var += 5; break;
+	case 4: var += 7; break;
+	case 5: var += 8; break;
+	default: var = 0;
+
+	}
+
+	return 1;
+
+}
+
+int main() {
+
+	int result = foo(3);
+	if(result != 1 || var != 129) {
+		abort();
+	}
+
+	exit(0);
+
+}
+
Index: gcc/testsuite/gcc.target/microblaze/others/sdata_var1.c
===================================================================
--- gcc/testsuite/gcc.target/microblaze/others/sdata_var1.c	(revision 258312)
+++ gcc/testsuite/gcc.target/microblaze/others/sdata_var1.c	(working copy)
@@ -1,4 +1,4 @@
-/* { dg-options "-mxl-gp-opt" } */
+/* { dg-options "-mxl-gp-opt -fno-pic" } */
 
 /* { dg-final { scan-assembler "\.sbss\[^2]+" } } */
 typedef int Boolean;
Index: gcc/testsuite/gcc.target/microblaze/others/sdata_var2.c
===================================================================
--- gcc/testsuite/gcc.target/microblaze/others/sdata_var2.c	(revision 258312)
+++ gcc/testsuite/gcc.target/microblaze/others/sdata_var2.c	(working copy)
@@ -1,4 +1,4 @@
-/* { dg-options "-mxl-gp-opt" } */
+/* { dg-options "-mxl-gp-opt -fno-pic" } */
 
 /* { dg-final { scan-assembler "\.sdata\[^2]+" } } */
 int global = 10;
Index: gcc/testsuite/gcc.target/microblaze/others/sdata_var3.c
===================================================================
--- gcc/testsuite/gcc.target/microblaze/others/sdata_var3.c	(revision 258312)
+++ gcc/testsuite/gcc.target/microblaze/others/sdata_var3.c	(working copy)
@@ -1,4 +1,4 @@
-/* { dg-options "-mxl-gp-opt" } */
+/* { dg-options "-mxl-gp-opt -fno-pic" } */
 
 extern int a;
 
Index: gcc/testsuite/gcc.target/microblaze/others/sdata_var4.c
===================================================================
--- gcc/testsuite/gcc.target/microblaze/others/sdata_var4.c	(revision 258312)
+++ gcc/testsuite/gcc.target/microblaze/others/sdata_var4.c	(working copy)
@@ -1,4 +1,4 @@
-/* { dg-options "-mxl-gp-opt -G 16" } */
+/* { dg-options "-mxl-gp-opt -G 16 -fno-pic" } */
 
 /* { dg-final { scan-assembler "\.sbss\[^2]+" } } */
 struct test_s {
Index: gcc/testsuite/gcc.target/microblaze/others/sdata_var5.c
===================================================================
--- gcc/testsuite/gcc.target/microblaze/others/sdata_var5.c	(revision 258312)
+++ gcc/testsuite/gcc.target/microblaze/others/sdata_var5.c	(working copy)
@@ -1,4 +1,4 @@
-/* { dg-options "-mxl-gp-opt -G 16" } */
+/* { dg-options "-mxl-gp-opt -G 16 -fno-pic" } */
 
 /* { dg-final { scan-assembler "\.sdata\[^2]+" } } */
 struct test_s {
Index: gcc/testsuite/gcc.target/microblaze/others/sdata_var6.c
===================================================================
--- gcc/testsuite/gcc.target/microblaze/others/sdata_var6.c	(revision 258312)
+++ gcc/testsuite/gcc.target/microblaze/others/sdata_var6.c	(working copy)
@@ -1,5 +1,4 @@
-/* { dg-options "-mxl-gp-opt -G 16" } */
-
+/* { dg-options "-mxl-gp-opt -G 16 -fno-pic" } */
 struct test_s {
     int a;
     int b;
Index: gcc/testsuite/gcc.target/microblaze/others/string_cst1_gpopt.c
===================================================================
--- gcc/testsuite/gcc.target/microblaze/others/string_cst1_gpopt.c	(revision 258312)
+++ gcc/testsuite/gcc.target/microblaze/others/string_cst1_gpopt.c	(working copy)
@@ -1,4 +1,4 @@
-/* { dg-options "-mxl-gp-opt" } */
+/* { dg-options "-mxl-gp-opt -fno-pic" } */
 
 #include <string.h>
 
Index: gcc/testsuite/gcc.target/microblaze/others/string_cst2_gpopt.c
===================================================================
--- gcc/testsuite/gcc.target/microblaze/others/string_cst2_gpopt.c	(revision 258312)
+++ gcc/testsuite/gcc.target/microblaze/others/string_cst2_gpopt.c	(working copy)
@@ -1,4 +1,4 @@
-/* { dg-options "-mxl-gp-opt" } */
+/* { dg-options "-mxl-gp-opt -fno-pic" } */
 
 #include <string.h>
 

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

* Re: [PATCH] [Microblaze]: PIC Data Text Relative
  2018-04-19 10:43                                         ` Andrew Sadek
@ 2018-04-27  1:41                                           ` Michael Eager
  2018-04-27 10:41                                             ` Andrew Sadek
  0 siblings, 1 reply; 27+ messages in thread
From: Michael Eager @ 2018-04-27  1:41 UTC (permalink / raw)
  To: Andrew Sadek, Michael Eager; +Cc: gcc-patches, nmekala

On 04/19/2018 03:43 AM, Andrew Sadek wrote:
> On Wed, Apr 18, 2018 at 6:57 PM, Michael Eager <eager@eagercon.com> wrote:
>>
>> Hi Andrew --
>>
>> Check indents in the following files:
>> (Make sure that your tabs are set at 8 chars.)
>> --- gcc/config/microblaze/microblaze.c
>> --- gcc/config/microblaze/microblaze.md
>>
> I have re-run check_GNU_Style.sh and no are issues are found now.

I corrected a large number of indent problems in microblaze.c.

>> Just a couple coding notes:
>>
>> microblaze.c:
>>
>> @@ -858,6 +879,16 @@ microblaze_classify_address (struct microblaze_add
>> +               && strict == 2)
>>
>> Include comment in function header describing meaning of strict == 2.
> 
> Done
> 
>>
>> @@ -1022,7 +1065,7 @@ microblaze_legitimize_address (rtx x, rtx oldx ATT
>>        else if (flag_pic == 2 && !TARGET_PIC_DATA_TEXT_REL)
>>          {
>>            ...
>>          }
>>        else if (flag_pic == 2 && TARGET_PIC_DATA_TEXT_REL)
>>          {
>>            ...
>>          }
>>
>> It's better to factor this into
>>       else if (flag_pic == 2)
>>         {
>>           if (TARGET_PIC_DATA_TEXT_REL)
>>             {
>>               ...
>>             }
>>           else
>>             {
>>               ...
>>             }
>>         }
>>
> 
> Done

This code pattern appears twice in microblaze_legitimize_address.
I corrected the second one.

The code in the second occurrence can be refactored to move

	  if (reload_in_progress)
	    df_set_regs_ever_live (PIC_OFFSET_TABLE_REGNUM, true);

out of the if(TARGET_PIC_DATA_TEXT_REL) brackets.  (Done.)


Please send me an updated ChangeLog, including testsuite.


-- 
Michael Eager    eager@eagerm.com
1960 Park Blvd., Palo Alto, CA 94306

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

* Re: [PATCH] [Microblaze]: PIC Data Text Relative
  2018-04-27  1:41                                           ` Michael Eager
@ 2018-04-27 10:41                                             ` Andrew Sadek
       [not found]                                               ` <1285bbac-fa9c-34f5-c43d-82c0c17d89c9@eagerm.com>
  0 siblings, 1 reply; 27+ messages in thread
From: Andrew Sadek @ 2018-04-27 10:41 UTC (permalink / raw)
  To: Michael Eager; +Cc: Michael Eager, gcc-patches, nmekala

Thanks Michael.
Please find below updated Change Log.

2018-04-27 Andrew Sadek  <andrew.sadek.se@gmail.com>

    Microblaze Target: PIC data text relative
    * gcc/config/microblaze/microblaze.opt: add new option
-mpic-is-data-text-relative.
    * gcc/config/microblaze/microblaze-protos.h (microblaze_constant_address_p):
    Add microblaze_constant_address_p function to encapsulate CONSTANT_ADDRESS_P
    in microblaze.h.
    * gcc/config/microblaze/microblaze.h (microblaze_constant_address_p):
    change CONSTANT_ADDRESS_P definition to microblaze_constant_address_p.
    * gcc/config/microblaze/microblaze.c (TARGET_PIC_DATA_TEXT_REL):
New addressing mode
    for data-text relative position independent code.
    (microblaze_classify_unspec): add 'UNSPEC_TEXT' case ->
'ADDRESS_SYMBOLIC_TXT_REL'.
    (microblaze_classify_address): add handling for UNSPEC + CONST_INT
+ SYMBOL_REF.
    (microblaze_legitimate_pic_operand): exclude function calls from
pic operands
    in case of TARGET_PIC_DATA_TEXT_REL option.
    (microblaze_legitimize_address): generate 'UNSPEC_TEXT' for all possible
    addresses cases.
    (microblaze_address_insns): add 'ADDRESS_SYMBOLIC_TXT_REL' case.
    (print_operand): add 'ADDRESS_SYMBOLIC_TXT_REL' case.
    (print_operand_address): add 'ADDRESS_SYMBOLIC_TXT_REL' case + handling for
    'address + offset' + set strict with 2 in microblaze_classify_address call.
    (microblaze_expand_prologue): add new function prologue call for
'r20' assignation.
    (microblaze_asm_generate_pic_addr_dif_vec): override new target hook
    'TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC' to disable address diff vector
    table in case of TARGET_PIC_DATA_TEXT_REL.
    (expand_pic_symbol_ref): add handling for TARGET_PIC_DATA_TEXT_REL cases.
    * gcc/config/microblaze/microblaze.md (TARGET_PIC_DATA_TEXT_REL):
    Add new macros 'UNSPEC_TEXT' and 'UNSPEC_SET_TEXT' +
    add rule for setting r20 in function prologue + exclude function calls
    from 'UNSPEC_PLT' in case of data text relative mode.
    * gcc/doc/tm.texi.in (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC):
    Add new target hook for generating address diff vector tables in
case of flag_pic.
    * gcc/doc/tm.texi : Regenerate.
    * gcc/stmt.c (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC): append new condition
    'targetm.asm_out.generate_pic_addr_diff_vec' to flag_pic in case
of address diff vector generation.
    * gcc/target.def (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC): add
target hook definition.
    * gcc/targhooks.c (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC):
    add default function for generate_pic_addr_diff_vec -> flag_pic.
    * gcc/targhooks.h (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC):
    add function declaration for generate_pic_addr_diff_vec.
    * gcc/doc/invoke.texi (Add new pic option): Add new microblaze pic
option -mpic-is-data-text-relative.
    * gcc/testsuite/gcc.target/microblaze/others/data_var1.c: include
PIC case of r20 base register.
    * gcc/testsuite/gcc.target/microblaze/others/data_var2.c: include
PIC case of r20 base register.
    * gcc/testsuite/gcc.target/microblaze/others/picdtr.c: add new
test case for -mpic-is-data-text-relative.
    * gcc/testsuite/gcc.target/microblaze/others/sdata_var1.c: add
-fno-pic to exclude small data from PIC.
    * gcc/testsuite/gcc.target/microblaze/others/sdata_var2.c: add
-fno-pic to exclude small data from PIC.
    * gcc/testsuite/gcc.target/microblaze/others/sdata_var3.c: add
-fno-pic to exclude small data from PIC.
    * gcc/testsuite/gcc.target/microblaze/others/sdata_var4.c: add
-fno-pic to exclude small data from PIC.
    * gcc/testsuite/gcc.target/microblaze/others/sdata_var5.c: add
-fno-pic to exclude small data from PIC.
    * gcc/testsuite/gcc.target/microblaze/others/sdata_var6.c: add
-fno-pic to exclude small data from PIC.
    * gcc/testsuite/gcc.target/microblaze/others/string_cst1_gpopt.c:
add -fno-pic to exclude small data from PIC.
    * gcc/testsuite/gcc.target/microblaze/others/string_cst2_gpopt.c:
add -fno-pic to exclude small data from PIC.

On Fri, Apr 27, 2018 at 3:36 AM, Michael Eager <eager@eagerm.com> wrote:
> On 04/19/2018 03:43 AM, Andrew Sadek wrote:
>>
>> On Wed, Apr 18, 2018 at 6:57 PM, Michael Eager <eager@eagercon.com> wrote:
>>>
>>>
>>> Hi Andrew --
>>>
>>> Check indents in the following files:
>>> (Make sure that your tabs are set at 8 chars.)
>>> --- gcc/config/microblaze/microblaze.c
>>> --- gcc/config/microblaze/microblaze.md
>>>
>> I have re-run check_GNU_Style.sh and no are issues are found now.
>
>
> I corrected a large number of indent problems in microblaze.c.
>
>>> Just a couple coding notes:
>>>
>>> microblaze.c:
>>>
>>> @@ -858,6 +879,16 @@ microblaze_classify_address (struct microblaze_add
>>> +               && strict == 2)
>>>
>>> Include comment in function header describing meaning of strict == 2.
>>
>>
>> Done
>>
>>>
>>> @@ -1022,7 +1065,7 @@ microblaze_legitimize_address (rtx x, rtx oldx ATT
>>>        else if (flag_pic == 2 && !TARGET_PIC_DATA_TEXT_REL)
>>>          {
>>>            ...
>>>          }
>>>        else if (flag_pic == 2 && TARGET_PIC_DATA_TEXT_REL)
>>>          {
>>>            ...
>>>          }
>>>
>>> It's better to factor this into
>>>       else if (flag_pic == 2)
>>>         {
>>>           if (TARGET_PIC_DATA_TEXT_REL)
>>>             {
>>>               ...
>>>             }
>>>           else
>>>             {
>>>               ...
>>>             }
>>>         }
>>>
>>
>> Done
>
>
> This code pattern appears twice in microblaze_legitimize_address.
> I corrected the second one.
>
> The code in the second occurrence can be refactored to move
>
>           if (reload_in_progress)
>             df_set_regs_ever_live (PIC_OFFSET_TABLE_REGNUM, true);
>
> out of the if(TARGET_PIC_DATA_TEXT_REL) brackets.  (Done.)
>
>
> Please send me an updated ChangeLog, including testsuite.
>
>
> --
> Michael Eager    eager@eagerm.com
>
> 1960 Park Blvd., Palo Alto, CA 94306



-- 

Andrew

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

* Re: [PATCH] [Microblaze]: PIC Data Text Relative
       [not found]                                               ` <1285bbac-fa9c-34f5-c43d-82c0c17d89c9@eagerm.com>
@ 2018-05-03 17:13                                                 ` Andrew Sadek
  2018-05-05 11:17                                                   ` Andrew Sadek
       [not found]                                                   ` <CAE=jbAMZJTQsEygLtPpXaSi=YGkOFje92CpEc6KhuuZk5HWCLA@mail.gmail.com>
  0 siblings, 2 replies; 27+ messages in thread
From: Andrew Sadek @ 2018-05-03 17:13 UTC (permalink / raw)
  To: gcc-patches

--resend Michael's reply

On Mon, Apr 30, 2018 at 1:19 PM, Michael Eager <eager@eagerm.com> wrote:

>
> Applied -- Committed revision 259758.
>
> Andrew -- Please re-run GCC regression test to verify that nothing
> was lost in the editing.
>
>
>
> --
> Michael Eager    eager@eagerm.com
> 1960 Park Blvd., Palo Alto, CA 94306
>



-- 

Andrew

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

* Re: [PATCH] [Microblaze]: PIC Data Text Relative
  2018-05-03 17:13                                                 ` Andrew Sadek
@ 2018-05-05 11:17                                                   ` Andrew Sadek
       [not found]                                                   ` <CAE=jbAMZJTQsEygLtPpXaSi=YGkOFje92CpEc6KhuuZk5HWCLA@mail.gmail.com>
  1 sibling, 0 replies; 27+ messages in thread
From: Andrew Sadek @ 2018-05-05 11:17 UTC (permalink / raw)
  To: gcc-patches, Michael Eager; +Cc: Michael Eager, nmekala

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

Hello Michael,

I made a re-run for the GCC test suite.
I have just noticed that picdtr.c was not uploaded, also I forgot to
adapt the new pic option text in it.
thus we need to apply the attached patch.

Otherwise, it's all fine.
Results (Normal Run):

        === gcc Summary ===

# of expected passes        91211
# of unexpected failures    1325
# of unexpected successes    3
# of expected failures        212
# of unresolved testcases    374
# of unsupported tests        2863

Results (with -fPIE -mpic-data-is-text-relative):
        === gcc Summary ===

# of expected passes        91243
# of unexpected failures    1208
# of unexpected successes    3
# of expected failures        212
# of unresolved testcases    374
# of unsupported tests        2888

Comparison for PASS-> FAIL is only this one now:
PASS->FAIL: gcc.dg/uninit-19.c (test for excess errors) => already
fails with -fPIE/-fPIC as mentioned before.

On Thu, May 3, 2018 at 7:13 PM, Andrew Sadek <andrew.sadek.se@gmail.com> wrote:
> --resend Michael's reply
>
> On Mon, Apr 30, 2018 at 1:19 PM, Michael Eager <eager@eagerm.com> wrote:
>>
>>
>> Applied -- Committed revision 259758.
>>
>> Andrew -- Please re-run GCC regression test to verify that nothing
>> was lost in the editing.
>>
>>
>>
>> --
>> Michael Eager    eager@eagerm.com
>> 1960 Park Blvd., Palo Alto, CA 94306
>
>
>
>
> --
>
> Andrew



-- 

Andrew

[-- Attachment #2: gcc.patch.txt --]
[-- Type: text/plain, Size: 2077 bytes --]

Index: picdtr.c
===================================================================
--- picdtr.c	(nonexistent)
+++ picdtr.c	(working copy)
@@ -0,0 +1,79 @@
+/* { dg-options "-fPIE mpic-data-is-text-relative -save-temps" } */
+/* { dg-do run } */
+
+#define TEST_VAR(var,val) (var) = (val); if( (var) != (val)) return 0;
+
+int foo(unsigned int i);
+extern void abort(void);
+extern void exit(int);
+
+unsigned char data[8];
+long bigData[7];
+long var;
+typedef struct {int a; short b; long c[1000][1000]; long long d[3][3]; char e; } myDef;
+myDef def;
+const char* myString;
+
+/* { dg-final { scan-assembler "mfs\tr20,rpc" } } */
+/* { dg-final { scan-assembler "addik\tr20,r20,8@TXTPCREL" } } */
+/* { dg-final { scan-assembler ",r20,\[^\n]*var\[^\n]*@TXTREL" } } */
+/* { dg-final { scan-assembler-not ",r0,\[^\n]*var" } } */
+/* { dg-final { scan-assembler ",r20,\[^\n]*bigData\[^\n]*@TXTREL" } } */
+/* { dg-final { scan-assembler-not ",r0,\[^\n]*bigData" } } */
+/* { dg-final { scan-assembler ",r20,\[^\n]*def\[^\n]*@TXTREL" } } */
+/* { dg-final { scan-assembler-not ",r0,\[^\n]*def" } } */
+/* { dg-final { scan-assembler ",r20,\[^\n]*data\[^\n]*@TXTREL" } } */
+/* { dg-final { scan-assembler-not ",r0,\[^\n]*data" } } */
+/* { dg-final { scan-assembler ",r20,\[^\n]*L\[^\n]*@TXTREL" } } */
+/* { dg-final { scan-assembler-not ",r0,\[^\n]*L" } } */
+
+
+
+void foo2() {
+	var++;
+}
+
+int foo (unsigned int i) {
+
+	TEST_VAR(var,123)
+	TEST_VAR(data[i],77)
+	TEST_VAR(data[2],88)
+	TEST_VAR(def.a,897)
+	TEST_VAR(bigData[i],78)
+	TEST_VAR(bigData[2],777)
+	TEST_VAR(def.b,12333);
+	TEST_VAR(def.c[i][i],5);
+	TEST_VAR(def.c[0][1],7);
+	TEST_VAR(def.d[1][2],123);
+	TEST_VAR(def.e,7);
+	TEST_VAR(bigData[i+1],bigData[i*2]);
+
+	foo2();
+
+	myString = "Hello";
+
+	switch(i){
+
+	case 1: var += 2; break;
+	case 2: var += 3; break;
+	case 3: var += 5; break;
+	case 4: var += 7; break;
+	case 5: var += 8; break;
+	default: var = 0;
+
+	}
+
+	return 1;
+
+}
+
+int main() {
+
+	int result = foo(3);
+	if(result != 1 || var != 129) {
+		abort();
+	}
+
+	exit(0);
+
+}

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

* Re: [PATCH] [Microblaze]: PIC Data Text Relative
       [not found]                                                   ` <CAE=jbAMZJTQsEygLtPpXaSi=YGkOFje92CpEc6KhuuZk5HWCLA@mail.gmail.com>
@ 2018-05-06 11:46                                                     ` Michael Eager
  0 siblings, 0 replies; 27+ messages in thread
From: Michael Eager @ 2018-05-06 11:46 UTC (permalink / raw)
  To: Andrew Sadek, gcc-patches; +Cc: nmekala

Committed.

On 05/05/2018 04:14 AM, Andrew Sadek wrote:
> Hello Michael,
> 
> I made a re-run for the GCC test suite.
> I have just noticed that picdtr.c was not uploaded, also I forgot to 
> adapt the new pic option text in it.
> thus we need to apply the attached patch.
> 
> Otherwise, it's all fine.
> Results (Normal Run):
> 
>          === gcc Summary ===
> 
> # of expected passes        91211
> # of unexpected failures    1325
> # of unexpected successes    3
> # of expected failures        212
> # of unresolved testcases    374
> # of unsupported tests        2863
> 
> Results (with -fPIE -mpic-data-is-text-relative):
>          === gcc Summary ===
> 
> # of expected passes        91243
> # of unexpected failures    1208
> # of unexpected successes    3
> # of expected failures        212
> # of unresolved testcases    374
> # of unsupported tests        2888
> 
> Comparison for PASS-> FAIL is only this one now:
> PASS->FAIL: gcc.dg/uninit-19.c (test for excess errors) => already fails 
> with -fPIE/-fPIC as mentioned before.
> 
> 
> 
> On Thu, May 3, 2018 at 7:13 PM, Andrew Sadek <andrew.sadek.se@gmail.com 
> <mailto:andrew.sadek.se@gmail.com>> wrote:
> 
>     --resend Michael's reply
> 
>     On Mon, Apr 30, 2018 at 1:19 PM, Michael Eager <eager@eagerm.com
>     <mailto:eager@eagerm.com>> wrote:
> 
> 
>         Applied -- Committed revision 259758.
> 
>         Andrew -- Please re-run GCC regression test to verify that nothing
>         was lost in the editing.
> 
> 
> 
>         -- 
>         Michael Eager eager@eagerm.com <mailto:eager@eagerm.com>
>         1960 Park Blvd., Palo Alto, CA 94306
> 
> 
> 
> 
>     -- 
> 
>     Andrew
> 
> 
> 
> 
> -- 
> 
> Andrew

-- 
Michael Eager    eager@eagerm.com
1960 Park Blvd., Palo Alto, CA 94306

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

* Re: [PATCH] [Microblaze]: PIC Data Text Relative
  2018-02-26  7:56 Andrew Guirguis
@ 2018-02-26  8:36 ` Andrew Sadek
  0 siblings, 0 replies; 27+ messages in thread
From: Andrew Sadek @ 2018-02-26  8:36 UTC (permalink / raw)
  To: gcc-patches, gdb-patches; +Cc: Michael Eager, nmekala

Change logs below.
There is a problem in attaching the bundle. I get permanent error from
sourceware.org

GCC ChangeLog:
Microblaze Target: PIC data text relative
* gcc/config/microblaze/microblaze.opt: add new option -mpic-data-text-rel.

* gcc/config/microblaze/microblaze-protos.h (microblaze_constant_address_p
):
Add microblaze_constant_address_p function instead of the macro in
microblaze.h
* gcc/config/microblaze/microblaze.c (TARGET_PIC_DATA_TEXT_REL): New
addressing mode
for data-text relative position indepenedent code.
(microblaze_classify_unspec): add 'UNSPEC_TEXT' case ->
'ADDRESS_SYMBOLIC_TXT_REL'.
(microblaze_classify_address): add handling for UNSPEC + CONST_INT.
(microblaze_legitimate_pic_operand): exclude function calls from pic
operands
in case of TARGET_PIC_DATA_TEXT_REL option.
(microblaze_legitimize_address): generate 'UNSPEC_TEXT' for all possible
addresses cases.
(microblaze_address_insns): add 'ADDRESS_SYMBOLIC_TXT_REL' case.
(print_operand): add 'ADDRESS_SYMBOLIC_TXT_REL' case.
(print_operand_address): add 'ADDRESS_SYMBOLIC_TXT_REL' case + handling for
'address + offset'.
(microblaze_expand_prologue): add new function prologue call for 'r20'
assignation.
(microblaze_asm_generate_pic_addr_dif_vec): override new target hook
'TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC' to disable address diff vector
table in case of TARGET_PIC_DATA_TEXT_REL.
(expand_pic_symbol_ref): add handling for 'UNSPEC_TEXT'.
* gcc/config/microblaze/microblaze.md (TARGET_PIC_DATA_TEXT_REL): Add new
macros 'UNSPEC_TEXT',
'UNSPEC_SET_TEXT' + add rule for setting r20 in function prologue + exclude
function calls
from 'UNSPEC_PLT' in case of data text relative mode.
* gcc/doc/tm.texi.in (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC): Add new
target hook for generating
address diff vector tables in case of flag_pic.
* gcc/doc/tm.texi : Regenerate.
* gcc/stmt.c (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC): append new condition
'targetm.asm_out.generate_pic_addr_diff_vec' to flag_pic in case of addr
diff vector generation.
* gcc/target.def (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC): add target hook
definition.
* gcc/targhooks.h, gcc/targhooks.c (TARGET_ASM_GENERATE_PIC_ADDR_DIFF_VEC):
add default function for generate_pic_addr_diff_vec -> flag_pic.

Binutils ChangeLog:
Microblaze Target: PIC data text relative
* include/elf/microblaze.h (Add 3 new relocations):
'R_MICROBLAZE_TEXTPCREL_64', 'R_MICROBLAZE_TEXTREL_64'
and 'R_MICROBLAZE_TEXTREL_32_LO' for relax function.
* bfd/bfd-in2.h, bfd/libbfd.h (2 new BFD relocations):
'BFD_RELOC_MICROBLAZE_64_TEXTPCREL' + 'BFD_RELOC_MICROBLAZE_64_TEXTPCREL'
* bfd/elf32-microblaze.c (Handle new relocs): define 'HOWTO' of 3 new
relocs and handle them in both relocate
and relax functions.
(microblaze_elf_reloc_type_lookup): add mapping between for new bfd relocs.
(microblaze_bfd_write_branch_absolute_value_64): replace relative branch
with absolute in case 'adjust_insn_abs_refs' is true
(microblaze_bfd_revert_base_reg_value_64): revert base register from r20 to
r0 in case 'adjust_insn_abs_refs' is true
(microblaze_elf_relocate_section): Handle new relocs in case of elf
relocation.
(microblaze_elf_relax_section): Handle new relocs for elf relaxation.
* gas/config/tc-microblaze.c (Handle new relocs directives in assembler):
Handle new relocs from compiler output.
(imm_types): add new imm types for data text relative addressing
'TEXT_OFFSET', 'TEXT_PC_OFFSET'
(md_convert_frag): conversion for 'BFD_RELOC_MICROBLAZE_64_TEXTPCREL' ,
'BFD_RELOC_MICROBLAZE_64_TEXTPCREL'
(md_apply_fix): apply fix for 'BFD_RELOC_MICROBLAZE_64_TEXTPCREL' ,
'BFD_RELOC_MICROBLAZE_64_TEXTPCREL'
(md_estimate_size_before_relax): estimate size for
'BFD_RELOC_MICROBLAZE_64_TEXTPCREL' , 'BFD_RELOC_MICROBLAZE_64_TEXTPCREL'
(tc_gen_reloc): generate relocations for 'BFD_RELOC_MICROBLAZE_64_TEXTPCREL'
, 'BFD_RELOC_MICROBLAZE_64_TEXTPCREL'
Add new linker options for static linking: adjust-insn-abs-refs,
disable-multiple-abs-defs
* ld/lexsup.c (Add 2 ld options):
(ld_options): add adjust-insn-abs-refs, disable-multiple-abs-defs @
'ld_options' array
(parse_args): parse options and pass flags to 'link_info' struct.
* ld/ldlex.h (Add 2 enums): add new enums @ 'option_values' enum.
* include/bfdlink.h (Add 2 flags): Add new flags @ 'bfd_link_info' struct.
* ld/main.c: Initialize flags with false @ 'main'. Handle
disable-multiple-abs-defs
@ 'mutiple_definition'.


On Mon, Feb 26, 2018 at 9:56 AM, Andrew Guirguis <andrew.sadek.se@gmail.com>
wrote:

> Dears,
>
> Kindly find the patch bundle for Microblaze '-mpic-data-text-relative'
> feature at the following link:
> https://github.com/andrewsadek/microblaze-pic-data-text-rel/
> tree/pic_data_text_rel/PATCH%20BUNDLE
>
> Description of the feature:
> https://github.com/andrewsadek/microblaze-pic-data-text-rel/
> blob/pic_data_text_rel/README.md
>
> Bundle includes:
> 1) Change logs for GCC, binutils
> 2) GCC Test results and comparison with the original.
> 3) New Test case (picdtr.c)
> 4) The Patches (against current heads)
>
> Thanks
>
> --
>
> Andrew
>



-- 

Andrew

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

* [PATCH] [Microblaze]: PIC Data Text Relative
@ 2018-02-26  7:56 Andrew Guirguis
  2018-02-26  8:36 ` Andrew Sadek
  0 siblings, 1 reply; 27+ messages in thread
From: Andrew Guirguis @ 2018-02-26  7:56 UTC (permalink / raw)
  To: gcc-patches, gdb-patches, eager, nmekala

 Dears,

Kindly find the patch bundle for Microblaze '-mpic-data-text-relative'
feature at the following link:
https://github.com/andrewsadek/microblaze-pic-data-text-rel/tree/pic_data_text_rel/PATCH%20BUNDLE

Description of the feature:
https://github.com/andrewsadek/microblaze-pic-data-text-rel/
blob/pic_data_text_rel/README.md

Bundle includes:
1) Change logs for GCC, binutils
2) GCC Test results and comparison with the original.
3) New Test case (picdtr.c)
4) The Patches (against current heads)

Thanks

-- 

Andrew

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

end of thread, other threads:[~2018-05-06 11:46 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAE=jbAMyXXpWUPnC_dcmyWNeOXcJ-Wo4+KomQ9KwpX2KuLDqkg@mail.gmail.com>
2018-02-27  0:07 ` [PATCH] [Microblaze]: PIC Data Text Relative Michael Eager
2018-02-27  8:14   ` Andrew Sadek
2018-03-02 16:12     ` Andrew Sadek
2018-03-05 19:21       ` Michael Eager
2018-03-12 13:19         ` Andrew Sadek
2018-03-12 14:30           ` Michael Eager
2018-03-13  6:10             ` Andrew Sadek
2018-03-13  6:42               ` Michael Eager
2018-03-13  7:56                 ` Andrew Sadek
2018-03-13 20:51                   ` Michael Eager
     [not found]                     ` <CAE=jbAMCJ_8HR=ztOrY_FLfhYEMAFivyMO=Tz8EBdagd9zgs5g@mail.gmail.com>
2018-03-18 14:56                       ` Andrew Sadek
2018-03-19 20:09                         ` Michael Eager
2018-03-20  1:30                           ` Michael Eager
2018-03-20  2:06                             ` Michael Eager
2018-03-20 14:18                               ` Andrew Sadek
2018-03-20 15:49                                 ` Michael Eager
2018-03-22 18:45                                   ` Andrew Sadek
2018-04-18 12:44                                     ` Andrew Sadek
2018-04-18 16:57                                       ` Michael Eager
2018-04-19 10:43                                         ` Andrew Sadek
2018-04-27  1:41                                           ` Michael Eager
2018-04-27 10:41                                             ` Andrew Sadek
     [not found]                                               ` <1285bbac-fa9c-34f5-c43d-82c0c17d89c9@eagerm.com>
2018-05-03 17:13                                                 ` Andrew Sadek
2018-05-05 11:17                                                   ` Andrew Sadek
     [not found]                                                   ` <CAE=jbAMZJTQsEygLtPpXaSi=YGkOFje92CpEc6KhuuZk5HWCLA@mail.gmail.com>
2018-05-06 11:46                                                     ` Michael Eager
2018-02-26  7:56 Andrew Guirguis
2018-02-26  8:36 ` Andrew Sadek

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