From: "Leif Lindholm" <leif.lindholm@linaro.org>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Baptiste Gerondeau <baptiste.gerondeau@linaro.org>,
edk2-devel-groups-io <devel@edk2.groups.io>,
"Kinney, Michael D" <michael.d.kinney@intel.com>,
"Gao, Liming" <liming.gao@intel.com>,
"Zhang, Shenglei" <shenglei.zhang@intel.com>,
Baptiste GERONDEAU <bgerondeau@gmail.com>
Subject: Re: [PATCH 2/3] ARM/Assembler: Correct syntax from RVCT for MSFT
Date: Thu, 19 Sep 2019 15:31:54 +0100 [thread overview]
Message-ID: <20190919143154.GX28454@bivouac.eciton.net> (raw)
In-Reply-To: <CAKv+Gu_L+8Mdu+xxfQAsSdB7NJQQHVd03K1u5qCvK4m5cvzVrQ@mail.gmail.com>
On Thu, Sep 19, 2019 at 03:36:50PM +0300, Ard Biesheuvel wrote:
> On Thu, 19 Sep 2019 at 14:25, Leif Lindholm <leif.lindholm@linaro.org> wrote:
> > > The problem is that the first branch instruction is patched into the
> > > FV files by the BaseTools, and so the startup code is entered in ARM
> > > mode by default.
> > >
> > > So that means we'll either have to
> > > 1) switch to ARM mode
> > > 2) emit one branch instruction
> > > 3) switch back to Thumb mode
> >
> > I was thinking more like tying down the entry function (or as I said,
> > the whole file) as ARM, then letting the toolchain decide for the bits
> > where we don't have instuction-set dependent ABIs.
> >
> > > 4) fix up all the code so it assembles in Thumb mode
> >
> > Which is what Baptiste has done in this set.
> >
> > > 1) switch to ARM mode
> >
> > In all 48 files (+3 in edk2-platforms), or just the ones where not
> > doing so triggers build errors? Currently.
> >
> > I'm OK with restricting ourselves to just setting ARM in the
> > triggering files for simplicity, especially in order to streamline the
> > toolchain migration from RVCT to VS (and the subsequent purge of PVCT
> > support). I'm not seeing it as a solution.
>
> As long as we align the .asm files with the .S files, I am fine with
> that. And since we focus on v7+ only these days, I'm fine with
> changing existing ARM files to Thumb2.
But I don't see us following this pattern today, for .S files.
Frankly, looking at it, I can't quite manage to untangle how we end up
generating A32 for .asm in the first place. Is it just the toolchain
default?
If we look for example at the post-build version of
Build/ArmVirtQemu-ARM/RELEASE_GCC5/ARM/ArmPkg/Library/ArmHvcLib/ArmHvcLib/OUTPUT/Arm/ArmHvc.iii
, there is no .arm directive.
That gets assembled into
Build/ArmVirtQemu-ARM/RELEASE_GCC5/ARM/ArmPkg/Library/ArmHvcLib/ArmHvcLib/OUTPUT/Arm/ArmHvc.obj
by the step
---
"arm-linux-gnueabihf-gcc" -march=armv7-a -c -x assembler -imacros
/work/git/tianocore/Build/ArmVirtQemu-ARM/RELEASE_GCC5/ARM/ArmPkg/Library/ArmHvcLib/ArmHvcLib/DEBUG/AutoGen.h
-mlittle-endian -o
/work/git/tianocore/Build/ArmVirtQemu-ARM/RELEASE_GCC5/ARM/ArmPkg/Library/ArmHvcLib/ArmHvcLib/OUTPUT/Arm/ArmHvc.obj
-I/work/git/edk2/ArmPkg/Library/ArmHvcLib/Arm
-I/work/git/edk2/ArmPkg/Library/ArmHvcLib
-I/work/git/tianocore/Build/ArmVirtQemu-ARM/RELEASE_GCC5/ARM/ArmPkg/Library/ArmHvcLib/ArmHvcLib/DEBUG
-I/work/git/edk2/MdePkg -I/work/git/edk2/MdePkg/Include
-I/work/git/edk2/MdePkg/Include/Arm -I/work/git/edk2/ArmPkg
-I/work/git/edk2/ArmPkg/Include /work/git/tianocore/Build/ArmVirtQemu-ARM/RELEASE_GCC5/ARM/ArmPkg/Library/ArmHvcLib/ArmHvcLib/OUTPUT/Arm/ArmHvc.iii
---
(Adding hilarity to the situation is the bit where we, when
preprocessing the file, explicitly pass -mthumb on the command line -
which is obviously ignored at that point.)
Fwiw, yes, it appears at least the Debian toolchain defaults to
assembling A32 if no .thumb directive is explicitly in place.
> What I don't want is a situation where the toolchain's default decides
> how code is assembled, since that means you have to test all your code
> changes twice.
And to me it looks like we avoid that problem today only by accident -
we are already relying on toolchain defaults for GCC.
Anyway, rewinding this about 27 steps ...
Are you OK with Baptiste going ahead and adding the ARM statement
*only* to the files requiring it to build[1] - and the one(s) requiring
it to operate properly (could you point it/them out please)?
[1]
Then the next question is whether he should also add it to the files
where that avoids the need for (some) refactoring of code, or whether
he should simply mirror the changes to .asm into .S?
The "we must tie down so that each .asm/.S file is only ever built to
a single instruction set" work is a substantial enough task, that I
hope we can undertake at a later date rather that rolling it into this
one.
/
Leif
next prev parent reply other threads:[~2019-09-19 14:31 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-18 12:25 [PATCH 0/3] Arm builds on Visual Studio Baptiste Gerondeau
2019-09-18 12:25 ` [PATCH 1/3] ArmPkg/MdePkg : Unify INF files format Baptiste Gerondeau
2019-09-19 9:29 ` Ard Biesheuvel
2019-09-18 12:25 ` [PATCH 2/3] ARM/Assembler: Correct syntax from RVCT for MSFT Baptiste Gerondeau
2019-09-19 9:32 ` Ard Biesheuvel
2019-09-19 9:48 ` Leif Lindholm
2019-09-19 10:01 ` Ard Biesheuvel
2019-09-19 10:09 ` Leif Lindholm
2019-09-19 10:25 ` Ard Biesheuvel
2019-09-19 10:34 ` Baptiste Gerondeau
2019-09-19 10:37 ` Ard Biesheuvel
2019-09-19 10:47 ` Leif Lindholm
2019-09-19 10:53 ` Ard Biesheuvel
2019-09-19 11:25 ` Leif Lindholm
2019-09-19 12:36 ` Ard Biesheuvel
2019-09-19 14:31 ` Leif Lindholm [this message]
2019-09-19 14:44 ` Ard Biesheuvel
2019-09-19 11:07 ` Baptiste Gerondeau
2019-09-19 10:37 ` Leif Lindholm
2019-09-18 12:25 ` [PATCH 3/3] ARM/Assembler: Reuse RVCT assembler for MSFT build Baptiste Gerondeau
2019-09-19 9:38 ` Ard Biesheuvel
2019-09-19 9:52 ` Leif Lindholm
2019-09-19 9:59 ` Ard Biesheuvel
2019-09-18 16:43 ` [PATCH 0/3] Arm builds on Visual Studio Leif Lindholm
2019-09-19 6:19 ` Liming Gao
2019-09-19 9:44 ` Leif Lindholm
2019-09-19 14:53 ` Liming Gao
2019-09-19 19:24 ` [edk2-devel] " Laszlo Ersek
2019-09-19 19:57 ` Andrew Fish
2019-09-19 20:27 ` Leif Lindholm
2019-09-24 1:28 ` Liming Gao
[not found] <cover.1568821123.git.baptiste.gerondeau@linaro.org>
2019-09-18 16:05 ` [PATCH 2/3] ARM/Assembler: Correct syntax from RVCT for MSFT Baptiste Gerondeau
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-list 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=20190919143154.GX28454@bivouac.eciton.net \
--to=devel@edk2.groups.io \
/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