Dear SeaBIOS folks,

my goal is to build SeaBIOS with the “fast memory error detector”
AddressSanitizer (ASan) [1].

As I did not find a way to override `CFLAGS` for building SeaBIOS, as
they are defined with `:=` in `Makefile`, I added `-fsanitize=address`
directly to `COMMONCFLAGS`.

        $ git diff
        diff --git a/Makefile b/Makefile
        index a4d945c..9a7897c 100644
        --- a/Makefile
        +++ b/Makefile
        @@ -58,7 +58,7 @@ COMMONCFLAGS := -I$(OUT) -Isrc -Os -MD -g \
             -m32 -march=i386 -mregparm=3 -mpreferred-stack-boundary=2 \
             -minline-all-stringops -fomit-frame-pointer \
             -freg-struct-return -ffreestanding -fno-delete-null-pointer-checks 
\
        -    -ffunction-sections -fdata-sections -fno-common 
-fno-merge-constants
        +    -ffunction-sections -fdata-sections -fno-common 
-fno-merge-constants -fsanitize=address
         COMMONCFLAGS += $(call cc-option,$(CC),-nopie,)
         COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
         COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,)

But, buidling SeaBIOS as a coreboot payload fails with a syntax error.

        […]
          Compiling (16bit) out/romlayout.o
          Building ld scripts
        Version:
        rel-1.8.0-24-g0b2165d-dirty-20150426_091353-myasrocke350m1
        Fixed space: 0xe05b-0x10000  total: 8101  slack: 12  Percent
        slack: 0.1%
        16bit size:           89760
        32bit segmented size: 9184
        32bit flat size:      65456
        32bit flat init size: 126720
        Lowmem size:          2176
        f-segment var size:   1200
          Linking out/rom16.o
        /usr/bin/ld.bfd.real:out/romlayout16.lds:8: syntax error
        Makefile:171: recipe for target 'out/rom16.o' failed
        make: *** [out/rom16.o] Error 1

The same happens when building SeaBIOS for QEMU/KVM.

        […]
          Building ld scripts
        Version: rel-1.8.0-24-g0b2165d-dirty-20150426_092029-myasrocke350m1
        Fixed space: 0xe05b-0x10000  total: 8101  slack: 12  Percent slack: 0.1%
        16bit size:           92640
        32bit segmented size: 9728
        32bit flat size:      82384
        32bit flat init size: 200864
        Lowmem size:          2176
        f-segment var size:   1200
          Linking out/rom16.o
        /usr/bin/ld.bfd.real:out/romlayout16.lds:9: syntax error
        Makefile:171: recipe for target 'out/rom16.o' failed
        make: *** [out/rom16.o] Error 1

Could you please suggest a way to build SeaBIOS with AddressSanitizer?

Also I’m still curious how possible warnings/messages from
AddressSanitzer will be shown to the user.


Thanks,

Paul


[1] https://code.google.com/p/address-sanitizer/

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios

Reply via email to