Message ID | 1470212464-28071-3-git-send-email-ard.biesheuvel@linaro.org |
---|---|
State | Accepted |
Commit | 87ee6390cbeb2d15490943bca2978f166f213c13 |
Headers | show |
On 08/03/16 10:21, Ard Biesheuvel wrote: > The clang developers have made a backward incompatible change to the > command line arguments, and have replaced '-mllvm -arm-use-movt=0' > with '-mno-movt'. This does not matter for most ARM platforms, and > therefore it has been removed from the default CLANG35/ARM CC flags > in patch 1c63516075b3 ("BaseTools CLANG35: drop problematic use-movt > and save-temps options"), but as it turns out, the relocatable PrePi > implementation used by ArmVirtQemuKernel and ArmVirtXen will fail to > build if it contains MOVT/MOVW pairs, due to the fact that these are > not runtime relocatable under ELF. > > Since they are runtime relocatable under PE/COFF, and GenFw does the > right thing when encountering them, selectively controlling their > use is more appropriate than disabling them altogether. Therefore, > this patch adds the -mno-movt argument only for the platforms that > use the relocatable PrePi, and only for the module types that may > be pulled into its build. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> > --- > ArmVirtPkg/ArmVirtQemuKernel.dsc | 8 ++++++++ > ArmVirtPkg/ArmVirtXen.dsc | 9 +++++++++ > 2 files changed, 17 insertions(+) > > diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc > index 01a1d9b4613b..6c536d9bbd2d 100644 > --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc > +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc > @@ -45,6 +45,9 @@ [LibraryClasses.ARM] > ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf > ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.inf > > +[LibraryClasses.ARM.SEC] > + ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf > + How does this library resolution change relate to the stated purpose of the patch? Thanks Laszlo > [LibraryClasses.common] > ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf > > @@ -77,6 +80,11 @@ [BuildOptions] > GCC:*_*_ARM_PLATFORM_FLAGS == -mcpu=cortex-a15 -I$(WORKSPACE)/ArmVirtPkg/Include > *_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/ArmVirtPkg/Include > > +[BuildOptions.ARM.EDKII.SEC, BuildOptions.ARM.EDKII.BASE] > + # Avoid MOVT/MOVW instruction pairs in code that may end up in the PIE > + # executable we build for the relocatable PrePi. They are not runtime > + # relocatable in ELF. > + *_CLANG35_*_CC_FLAGS = -mno-movt > > ################################################################################ > # > diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc > index 5ad1bf630bda..4ebead5ba6e6 100644 > --- a/ArmVirtPkg/ArmVirtXen.dsc > +++ b/ArmVirtPkg/ArmVirtXen.dsc > @@ -44,6 +44,9 @@ [LibraryClasses.ARM] > ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf > ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.inf > > +[LibraryClasses.ARM.SEC] > + ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf > + > [LibraryClasses.common] > ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf > > @@ -77,6 +80,12 @@ [BuildOptions] > GCC:*_*_ARM_PLATFORM_FLAGS == -mcpu=cortex-a15 -I$(WORKSPACE)/ArmVirtPkg/Include > GCC:*_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/ArmVirtPkg/Include > > +[BuildOptions.ARM.EDKII.SEC, BuildOptions.ARM.EDKII.BASE] > + # Avoid MOVT/MOVW instruction pairs in code that may end up in the PIE > + # executable we build for the relocatable PrePi. They are not runtime > + # relocatable in ELF. > + *_CLANG35_*_CC_FLAGS = -mno-movt > + > ################################################################################ > # > # Pcd Section - list of all EDK II PCD Entries defined by this Platform > _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
On 3 August 2016 at 12:00, Laszlo Ersek <lersek@redhat.com> wrote: > On 08/03/16 10:21, Ard Biesheuvel wrote: >> The clang developers have made a backward incompatible change to the >> command line arguments, and have replaced '-mllvm -arm-use-movt=0' >> with '-mno-movt'. This does not matter for most ARM platforms, and >> therefore it has been removed from the default CLANG35/ARM CC flags >> in patch 1c63516075b3 ("BaseTools CLANG35: drop problematic use-movt >> and save-temps options"), but as it turns out, the relocatable PrePi >> implementation used by ArmVirtQemuKernel and ArmVirtXen will fail to >> build if it contains MOVT/MOVW pairs, due to the fact that these are >> not runtime relocatable under ELF. >> >> Since they are runtime relocatable under PE/COFF, and GenFw does the >> right thing when encountering them, selectively controlling their >> use is more appropriate than disabling them altogether. Therefore, >> this patch adds the -mno-movt argument only for the platforms that >> use the relocatable PrePi, and only for the module types that may >> be pulled into its build. >> >> Contributed-under: TianoCore Contribution Agreement 1.0 >> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> >> --- >> ArmVirtPkg/ArmVirtQemuKernel.dsc | 8 ++++++++ >> ArmVirtPkg/ArmVirtXen.dsc | 9 +++++++++ >> 2 files changed, 17 insertions(+) >> >> diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc >> index 01a1d9b4613b..6c536d9bbd2d 100644 >> --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc >> +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc >> @@ -45,6 +45,9 @@ [LibraryClasses.ARM] >> ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf >> ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.inf >> >> +[LibraryClasses.ARM.SEC] >> + ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf >> + > > How does this library resolution change relate to the stated purpose of > the patch? > It prevents a version of ArmLib being pulled into the build of the relocatable PrePi that was built using the BuildOptions for DXE_DRIVER type modules. -- Ard. _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
On 08/03/16 12:02, Ard Biesheuvel wrote: > On 3 August 2016 at 12:00, Laszlo Ersek <lersek@redhat.com> wrote: >> On 08/03/16 10:21, Ard Biesheuvel wrote: >>> The clang developers have made a backward incompatible change to the >>> command line arguments, and have replaced '-mllvm -arm-use-movt=0' >>> with '-mno-movt'. This does not matter for most ARM platforms, and >>> therefore it has been removed from the default CLANG35/ARM CC flags >>> in patch 1c63516075b3 ("BaseTools CLANG35: drop problematic use-movt >>> and save-temps options"), but as it turns out, the relocatable PrePi >>> implementation used by ArmVirtQemuKernel and ArmVirtXen will fail to >>> build if it contains MOVT/MOVW pairs, due to the fact that these are >>> not runtime relocatable under ELF. >>> >>> Since they are runtime relocatable under PE/COFF, and GenFw does the >>> right thing when encountering them, selectively controlling their >>> use is more appropriate than disabling them altogether. Therefore, >>> this patch adds the -mno-movt argument only for the platforms that >>> use the relocatable PrePi, and only for the module types that may >>> be pulled into its build. >>> >>> Contributed-under: TianoCore Contribution Agreement 1.0 >>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> >>> --- >>> ArmVirtPkg/ArmVirtQemuKernel.dsc | 8 ++++++++ >>> ArmVirtPkg/ArmVirtXen.dsc | 9 +++++++++ >>> 2 files changed, 17 insertions(+) >>> >>> diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc >>> index 01a1d9b4613b..6c536d9bbd2d 100644 >>> --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc >>> +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc >>> @@ -45,6 +45,9 @@ [LibraryClasses.ARM] >>> ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf >>> ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.inf >>> >>> +[LibraryClasses.ARM.SEC] >>> + ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf >>> + >> >> How does this library resolution change relate to the stated purpose of >> the patch? >> > > It prevents a version of ArmLib being pulled into the build of the > relocatable PrePi that was built using the BuildOptions for DXE_DRIVER > type modules. > I think it would be reasonable to add this one paragraph to the commit message as well. If you disagree, I won't insist. :) Reviewed-by: Laszlo Ersek <lersek@redhat.com> _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
On 3 August 2016 at 13:19, Laszlo Ersek <lersek@redhat.com> wrote: > On 08/03/16 12:02, Ard Biesheuvel wrote: >> On 3 August 2016 at 12:00, Laszlo Ersek <lersek@redhat.com> wrote: >>> On 08/03/16 10:21, Ard Biesheuvel wrote: >>>> The clang developers have made a backward incompatible change to the >>>> command line arguments, and have replaced '-mllvm -arm-use-movt=0' >>>> with '-mno-movt'. This does not matter for most ARM platforms, and >>>> therefore it has been removed from the default CLANG35/ARM CC flags >>>> in patch 1c63516075b3 ("BaseTools CLANG35: drop problematic use-movt >>>> and save-temps options"), but as it turns out, the relocatable PrePi >>>> implementation used by ArmVirtQemuKernel and ArmVirtXen will fail to >>>> build if it contains MOVT/MOVW pairs, due to the fact that these are >>>> not runtime relocatable under ELF. >>>> >>>> Since they are runtime relocatable under PE/COFF, and GenFw does the >>>> right thing when encountering them, selectively controlling their >>>> use is more appropriate than disabling them altogether. Therefore, >>>> this patch adds the -mno-movt argument only for the platforms that >>>> use the relocatable PrePi, and only for the module types that may >>>> be pulled into its build. >>>> >>>> Contributed-under: TianoCore Contribution Agreement 1.0 >>>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> >>>> --- >>>> ArmVirtPkg/ArmVirtQemuKernel.dsc | 8 ++++++++ >>>> ArmVirtPkg/ArmVirtXen.dsc | 9 +++++++++ >>>> 2 files changed, 17 insertions(+) >>>> >>>> diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc >>>> index 01a1d9b4613b..6c536d9bbd2d 100644 >>>> --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc >>>> +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc >>>> @@ -45,6 +45,9 @@ [LibraryClasses.ARM] >>>> ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf >>>> ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.inf >>>> >>>> +[LibraryClasses.ARM.SEC] >>>> + ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf >>>> + >>> >>> How does this library resolution change relate to the stated purpose of >>> the patch? >>> >> >> It prevents a version of ArmLib being pulled into the build of the >> relocatable PrePi that was built using the BuildOptions for DXE_DRIVER >> type modules. >> > > I think it would be reasonable to add this one paragraph to the commit > message as well. If you disagree, I won't insist. :) > No, you're quite right. I'm still a bit confused that a SEC module can include DXE_DRIVER type libraries, but I guess it doesn't matter if there is no constructor. > Reviewed-by: Laszlo Ersek <lersek@redhat.com> Thank you, Ard. _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc index 01a1d9b4613b..6c536d9bbd2d 100644 --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc @@ -45,6 +45,9 @@ [LibraryClasses.ARM] ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.inf +[LibraryClasses.ARM.SEC] + ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf + [LibraryClasses.common] ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf @@ -77,6 +80,11 @@ [BuildOptions] GCC:*_*_ARM_PLATFORM_FLAGS == -mcpu=cortex-a15 -I$(WORKSPACE)/ArmVirtPkg/Include *_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/ArmVirtPkg/Include +[BuildOptions.ARM.EDKII.SEC, BuildOptions.ARM.EDKII.BASE] + # Avoid MOVT/MOVW instruction pairs in code that may end up in the PIE + # executable we build for the relocatable PrePi. They are not runtime + # relocatable in ELF. + *_CLANG35_*_CC_FLAGS = -mno-movt ################################################################################ # diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc index 5ad1bf630bda..4ebead5ba6e6 100644 --- a/ArmVirtPkg/ArmVirtXen.dsc +++ b/ArmVirtPkg/ArmVirtXen.dsc @@ -44,6 +44,9 @@ [LibraryClasses.ARM] ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.inf +[LibraryClasses.ARM.SEC] + ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf + [LibraryClasses.common] ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf @@ -77,6 +80,12 @@ [BuildOptions] GCC:*_*_ARM_PLATFORM_FLAGS == -mcpu=cortex-a15 -I$(WORKSPACE)/ArmVirtPkg/Include GCC:*_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/ArmVirtPkg/Include +[BuildOptions.ARM.EDKII.SEC, BuildOptions.ARM.EDKII.BASE] + # Avoid MOVT/MOVW instruction pairs in code that may end up in the PIE + # executable we build for the relocatable PrePi. They are not runtime + # relocatable in ELF. + *_CLANG35_*_CC_FLAGS = -mno-movt + ################################################################################ # # Pcd Section - list of all EDK II PCD Entries defined by this Platform
The clang developers have made a backward incompatible change to the command line arguments, and have replaced '-mllvm -arm-use-movt=0' with '-mno-movt'. This does not matter for most ARM platforms, and therefore it has been removed from the default CLANG35/ARM CC flags in patch 1c63516075b3 ("BaseTools CLANG35: drop problematic use-movt and save-temps options"), but as it turns out, the relocatable PrePi implementation used by ArmVirtQemuKernel and ArmVirtXen will fail to build if it contains MOVT/MOVW pairs, due to the fact that these are not runtime relocatable under ELF. Since they are runtime relocatable under PE/COFF, and GenFw does the right thing when encountering them, selectively controlling their use is more appropriate than disabling them altogether. Therefore, this patch adds the -mno-movt argument only for the platforms that use the relocatable PrePi, and only for the module types that may be pulled into its build. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> --- ArmVirtPkg/ArmVirtQemuKernel.dsc | 8 ++++++++ ArmVirtPkg/ArmVirtXen.dsc | 9 +++++++++ 2 files changed, 17 insertions(+) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel