public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Renlin Li <renlin.li@foss.arm.com>
To: Christophe Lyon <christophe.lyon@linaro.org>
Cc: kugan <kugan.vivekanandarajah@linaro.org>,
	"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	Kyrill Tkachov <kyrylo.tkachov@arm.com>,
	Ramana Radhakrishnan <Ramana.Radhakrishnan@arm.com>
Subject: Re: [PATCH][ARM]Use different startfile and endfile for elf target when generating shared object.
Date: Fri, 13 Jan 2017 12:26:00 -0000	[thread overview]
Message-ID: <5878C77E.8020203@foss.arm.com> (raw)
In-Reply-To: <CAKdteOY3jhuZZjghMcS5WZDWD0emAXzPRieeLtrcn=huEC1M6g@mail.gmail.com>

Hi Christophe,

On 13/01/17 11:14, Christophe Lyon wrote:
> On 13 January 2017 at 11:22, Renlin Li <renlin.li@foss.arm.com> wrote:
>> Hi Christophe,
>>
>> Thanks for testing the patch!
>> I check the test case gcc.dg/lto/pr54709, it seems the test case is not
>> properly written.
>>
>> It add extra ld option -shared without checking the target support for that.
>> After the change, this compilation will fail as a regression.
>> IIUC, '-shared' option is required, it should be gated with corresponding
>> target selector.
>>
>> "g++.dg/ipa/devirt-28a.C" now is skipped because of the target selector
>> there.
>> // { dg-do link { target { { gld && fpic } && shared } } }
>>
>> perhaps "gcc.dg/lto/pr54709" should do similar things like this:
>> // { dg-do link { target { shared } } }
> Quite likely, indeed.
>
>>
>>
>> As far as I know, with different cpu/arch configurations, different
>> relocations are generated in the library, some of the relocations are not
>> allowed to be used in shared
>> object.
>>
>> With -march=armv7-a (and the --with-cpu=cortex-a9 option you mentioned), the
>> linking stage of the test will fail because of this error:
>> "relocation XXX against external symbol `YYY' can not be used when making a
>> shared object"
>> for instance: crtbegin.o: relocation R_ARM_MOVW_ABS_NC against `a local
>> symbol` can not be used when making a shared object; recompile with -fPIC
>>
>> If you are luck enough, for example with arm7tdmi cpu, no such relocation is
>> generated in startup files. The "shared" target support check will pass for
>> simple and naive code.
>> "--with-cpu=cortex-m3" should be this case. But the test cases which require
>> shared object support will fail.
>>
>>
>> So this "shared" target checking mechanism is not reliable. The patch is to
>> change this.
>>
> Shouldn't your patch imply that several tests move from "fail" to
> "unsupported" on armv7-a ? I'm surprised not to see any difference in the
> results.
>
>>

Oops, I reordered the explanation paragraphs in my last email, making it obscure.

The "shared" target check will fail on armv7-a architecture because of the reason
mentioned below. So they are already been ignored. After the change, they are still
marked as "unsupported", but with a different reason. "crtbeginS.o cannot be found"

The deja-gnu test framework will compose a small program to test whether the toolchain
supports "shared" option.

 >> With -march=armv7-a (and the --with-cpu=cortex-a9 option you mentioned), the
 >> linking stage of the test will fail because of this error:
 >> "relocation XXX against external symbol `YYY' can not be used when making a
 >> shared object"
 >> for instance: crtbegin.o: relocation R_ARM_MOVW_ABS_NC against `a local
 >> symbol` can not be used when making a shared object; recompile with -fPIC
 >>

So the check won't pass, and the test case is marked as "unsupported".

 >> If you are luck enough, for example with arm7tdmi cpu, no such relocation is
 >> generated in startup files. The "shared" target support check will pass for
 >> simple and naive code.
 >> "--with-cpu=cortex-m3" should be this case. But the test cases which require
 >> shared object support will fail.

So for the same test case,
With "--with-cpu=cortex-m3",
The "shared" target support check will pass. It is marked as supported, but fail to 
produce binary.
with --with-cpu=cortex-a9",
The "shared" target support check will fail. it is marked as "unsupported" and skipped.

After the change, the test case will marked as "unsupported" regardless of the
cpu/arch configuration.

Regards,
Renlin

  reply	other threads:[~2017-01-13 12:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-16 11:04 Renlin Li
2016-12-14 15:34 ` [PING][PATCH][ARM]Use " Renlin Li
2017-01-12 11:24   ` Renlin Li
2017-06-07 16:41   ` Renlin Li
2017-01-12 11:47 ` [PATCH][ARM]Use " kugan
2017-01-12 15:50   ` Renlin Li
2017-01-13  8:48     ` Christophe Lyon
2017-01-13 10:22       ` Renlin Li
2017-01-13 11:14         ` Christophe Lyon
2017-01-13 12:26           ` Renlin Li [this message]
2017-01-13 12:45             ` Christophe Lyon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5878C77E.8020203@foss.arm.com \
    --to=renlin.li@foss.arm.com \
    --cc=Ramana.Radhakrishnan@arm.com \
    --cc=christophe.lyon@linaro.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kugan.vivekanandarajah@linaro.org \
    --cc=kyrylo.tkachov@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).