Message ID | 1458220972-12279-1-git-send-email-leif.lindholm@linaro.org |
---|---|
State | Accepted |
Commit | 3f7f28717892d8c82065f25070d36ba7eca3dccd |
Headers | show |
On 17 March 2016 at 14:22, Leif Lindholm <leif.lindholm@linaro.org> wrote: > By default, the ARM architectures have unsigned chars, whereas the other > architectures supported by EDK2 by default have signed chars. > However, EDK2 uses -funsigned-chars on those architectures to change the > default behaviour. > > Unfortunately, the ARM architectures explicitly break their default > behaviour by specifying -fsigned-chars (I presume in a pre-emptive > attempt at avoiding incompatibility). > > Since this situation is already confusing enough, switch the ARM > architectures to also specify -funsigned-chars explicitly rather than > just dropping the current parameter. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> > --- > BaseTools/Conf/tools_def.template | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template > index b1577af..eedf80f 100644 > --- a/BaseTools/Conf/tools_def.template > +++ b/BaseTools/Conf/tools_def.template > @@ -4322,8 +4322,8 @@ DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-strict-aliasing - > DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe > DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address -mno-stack-arg-probe > DEFINE GCC_IPF_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -minline-int-divide-min-latency > -DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi=aapcs -fno-short-enums -save-temps -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft > -DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -save-temps -fverbose-asm -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address -fno-asynchronous-unwind-tables > +DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi=aapcs -fno-short-enums -save-temps -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft > +DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -save-temps -fverbose-asm -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address -fno-asynchronous-unwind-tables > DEFINE GCC_AARCH64_CC_XIPFLAGS = -mstrict-align > DEFINE GCC_DLINK_FLAGS_COMMON = -nostdlib --pie > DEFINE GCC_DLINK2_FLAGS_COMMON = --script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds > -- > 2.1.4 > _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Hi Andrew, On Thu, Mar 17, 2016 at 10:41:37AM -0700, Andrew Fish wrote: > FYI, the char sign issue clang hit recently was due to mixing edk2 > types with standard C type. The edk2 type system does not assume > that char is signed or unsigned. I agree the type system gets it right, but the processor bindings do not :) > MdePkg/Include/X64/ProcessorBind.h > /// > /// 1-byte unsigned value > /// > typedef unsigned char UINT8; > /// > /// 1-byte Character > /// > typedef char CHAR8; On X64 and IA32, this will be unsigned with XCODE5 toolchains and signed with other toolchains. Regards, Leif > /// > /// 1-byte signed value > /// > typedef signed char INT8; > > > Thanks, > > Andrew Fish > > > On Mar 17, 2016, at 6:22 AM, Leif Lindholm <leif.lindholm@linaro.org> wrote: > > > > By default, the ARM architectures have unsigned chars, whereas the other > > architectures supported by EDK2 by default have signed chars. > > However, EDK2 uses -funsigned-chars on those architectures to change the > > default behaviour. > > > > Unfortunately, the ARM architectures explicitly break their default > > behaviour by specifying -fsigned-chars (I presume in a pre-emptive > > attempt at avoiding incompatibility). > > > > Since this situation is already confusing enough, switch the ARM > > architectures to also specify -funsigned-chars explicitly rather than > > just dropping the current parameter. > > > > Contributed-under: TianoCore Contribution Agreement 1.0 > > Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> > > --- > > BaseTools/Conf/tools_def.template | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template > > index b1577af..eedf80f 100644 > > --- a/BaseTools/Conf/tools_def.template > > +++ b/BaseTools/Conf/tools_def.template > > @@ -4322,8 +4322,8 @@ DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-strict-aliasing - > > DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe > > DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address -mno-stack-arg-probe > > DEFINE GCC_IPF_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -minline-int-divide-min-latency > > -DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi=aapcs -fno-short-enums -save-temps -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft > > -DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -save-temps -fverbose-asm -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address -fno-asynchronous-unwind-tables > > +DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi=aapcs -fno-short-enums -save-temps -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft > > +DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -save-temps -fverbose-asm -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address -fno-asynchronous-unwind-tables > > DEFINE GCC_AARCH64_CC_XIPFLAGS = -mstrict-align > > DEFINE GCC_DLINK_FLAGS_COMMON = -nostdlib --pie > > DEFINE GCC_DLINK2_FLAGS_COMMON = --script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds > > -- > > 2.1.4 > > > > _______________________________________________ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://lists.01.org/mailman/listinfo/edk2-devel > _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
On Thu, Mar 17, 2016 at 02:09:56PM -0700, Andrew Fish wrote: > > > On Mar 17, 2016, at 10:51 AM, Leif Lindholm <leif.lindholm@linaro.org> wrote: > > > > Hi Andrew, > > > > On Thu, Mar 17, 2016 at 10:41:37AM -0700, Andrew Fish wrote: > >> FYI, the char sign issue clang hit recently was due to mixing edk2 > >> types with standard C type. The edk2 type system does not assume > >> that char is signed or unsigned. > > > > I agree the type system gets it right, but the processor bindings do > > not :) > > > >> MdePkg/Include/X64/ProcessorBind.h > >> /// > >> /// 1-byte unsigned value > >> /// > >> typedef unsigned char UINT8; > >> /// > >> /// 1-byte Character > >> /// > >> typedef char CHAR8; > > > > On X64 and IA32, this will be unsigned with XCODE5 toolchains and > > signed with other toolchains. > > > > Depends how you look at it CHAR8 is compatible with char. But you > can't assume that char or CHAR8 is the same as UINT8 or INT8. > > Are you advocating we force CHAR8 to be signed? I am saying that by my interpretation of the UEFI specification, CHAR8 must be unsigned - as it cannot otherwise correctly represent the ISO-Latin-1 charset. If that interpretation is incorrect, I'm happy to be told so. Regards, Leif > Thanks, > > Andrew Fish > > > Regards, > > > > Leif > > > >> /// > >> /// 1-byte signed value > >> /// > >> typedef signed char INT8; > >> > >> > >> Thanks, > >> > >> Andrew Fish > >> > >>> On Mar 17, 2016, at 6:22 AM, Leif Lindholm <leif.lindholm@linaro.org> wrote: > >>> > >>> By default, the ARM architectures have unsigned chars, whereas the other > >>> architectures supported by EDK2 by default have signed chars. > >>> However, EDK2 uses -funsigned-chars on those architectures to change the > >>> default behaviour. > >>> > >>> Unfortunately, the ARM architectures explicitly break their default > >>> behaviour by specifying -fsigned-chars (I presume in a pre-emptive > >>> attempt at avoiding incompatibility). > >>> > >>> Since this situation is already confusing enough, switch the ARM > >>> architectures to also specify -funsigned-chars explicitly rather than > >>> just dropping the current parameter. > >>> > >>> Contributed-under: TianoCore Contribution Agreement 1.0 > >>> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> > >>> --- > >>> BaseTools/Conf/tools_def.template | 4 ++-- > >>> 1 file changed, 2 insertions(+), 2 deletions(-) > >>> > >>> diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template > >>> index b1577af..eedf80f 100644 > >>> --- a/BaseTools/Conf/tools_def.template > >>> +++ b/BaseTools/Conf/tools_def.template > >>> @@ -4322,8 +4322,8 @@ DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-strict-aliasing - > >>> DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe > >>> DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address -mno-stack-arg-probe > >>> DEFINE GCC_IPF_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -minline-int-divide-min-latency > >>> -DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi=aapcs -fno-short-enums -save-temps -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft > >>> -DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -save-temps -fverbose-asm -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address -fno-asynchronous-unwind-tables > >>> +DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi=aapcs -fno-short-enums -save-temps -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft > >>> +DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -save-temps -fverbose-asm -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address -fno-asynchronous-unwind-tables > >>> DEFINE GCC_AARCH64_CC_XIPFLAGS = -mstrict-align > >>> DEFINE GCC_DLINK_FLAGS_COMMON = -nostdlib --pie > >>> DEFINE GCC_DLINK2_FLAGS_COMMON = --script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds > >>> -- > >>> 2.1.4 > >>> > >>> _______________________________________________ > >>> edk2-devel mailing list > >>> edk2-devel@lists.01.org > >>> https://lists.01.org/mailman/listinfo/edk2-devel > >> > > _______________________________________________ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://lists.01.org/mailman/listinfo/edk2-devel > _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index b1577af..eedf80f 100644 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -4322,8 +4322,8 @@ DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-strict-aliasing - DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address -mno-stack-arg-probe DEFINE GCC_IPF_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -minline-int-divide-min-latency -DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi=aapcs -fno-short-enums -save-temps -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft -DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -save-temps -fverbose-asm -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address -fno-asynchronous-unwind-tables +DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi=aapcs -fno-short-enums -save-temps -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft +DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -save-temps -fverbose-asm -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address -fno-asynchronous-unwind-tables DEFINE GCC_AARCH64_CC_XIPFLAGS = -mstrict-align DEFINE GCC_DLINK_FLAGS_COMMON = -nostdlib --pie DEFINE GCC_DLINK2_FLAGS_COMMON = --script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
By default, the ARM architectures have unsigned chars, whereas the other architectures supported by EDK2 by default have signed chars. However, EDK2 uses -funsigned-chars on those architectures to change the default behaviour. Unfortunately, the ARM architectures explicitly break their default behaviour by specifying -fsigned-chars (I presume in a pre-emptive attempt at avoiding incompatibility). Since this situation is already confusing enough, switch the ARM architectures to also specify -funsigned-chars explicitly rather than just dropping the current parameter. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> --- BaseTools/Conf/tools_def.template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.1.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel