bios bits for QEMU acpi tests

Ani Sinha posted 1 patch 1 year, 11 months ago
bios bits for QEMU acpi tests
Posted by Ani Sinha 1 year, 11 months ago
Hi Josh:
I am looking into integrating bios bits into Qemu functional tests for
acpi. Towards that end, I am trying to compile the code on a newer
compiler as we might need to make some changes, for example, update acpica
so that it can recognize newer tables etc.

gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0


Since grub/python etc are quite old in the tree, on the newer copiler it
does not build out of the box (it does however build fine on my centos 7.9
vm with gcc version 4.8.5 20150623 (Red Hat 4.8.5-44)).

I have resolved a number of issues and warnings when compiling it on the
new version of gcc. I will at some point clean then up and share the
changes through my github (most are cosmetic). However, there is one last
issue which I am not
able to get past:

_GLOBAL_OFFSET_TABLE_ in python is not defined

$ nm -g -P -p --undefined build/grub-build-i386-pc/grub-core/python.module
| grep -i global
_GLOBAL_OFFSET_TABLE_ U

I have made the following change in rc/python/Makefile.core.def but with
no help:


--- a/rc/python/Makefile.core.def
+++ b/rc/python/Makefile.core.def
@@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 module = {
         name = python;
         cppflags = '-I$(top_srcdir)/contrib/python -I$(srcdir)/contrib-deps/python/Include -D_IEEE_LIBM -D__LITTLE_ENDIAN= -I$(srcdir)/contrib-deps/fdlibm $(CONTRIB_CPPFLAGS) -include contrib/acpica/acenv.h -DGRUB2 -DACPI_LIBRARY -I$(top_srcdir)/contrib/acpica -I$(srcdir)/contrib-deps/acpica/source/include -U__ELF__ -I$(srcdir)/contrib-deps/libffi/include -I$(srcdir)/contrib-deps/libffi/src/x86 -I$(srcdir)/contrib-deps/python/Modules/zlib';
-        cflags = '$(CONTRIB_CFLAGS) -fshort-wchar -maccumulate-outgoing-args -Wno-empty-body -Wno-float-equal -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-missing-declarations -Wno-missing-format-attribute -Wno-missing-noreturn -Wno-missing-prototypes -Wno-nested-externs -Wno-old-style-definition -Wno-parentheses -Wno-redundant-decls -Wno-sign-compare -Wno-shadow -Wno-shift-negative-value -Wno-type-limits -Wno-undef -Wno-uninitialized -Wno-unused -Wno-unused-parameter -Wno-unused-value -Wno-unused-variable -Wno-write-strings';
+        cflags = '$(CONTRIB_CFLAGS) -fshort-wchar -fno-pie -no-pie -maccumulate-outgoing-args -Wno-empty-body -Wno-float-equal -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-missing-declarations -Wno-missing-format-attribute -Wno-missing-noreturn -Wno-missing-prototypes -Wno-nested-externs -Wno-old-style-definition -Wno-parentheses -Wno-redundant-decls -Wno-sign-compare -Wno-shadow -Wno-shift-negative-value -Wno-type-limits -Wno-undef -Wno-uninitialized -Wno-unused -Wno-unused-parameter -Wno-unused-value -Wno-unused-variable -Wno-write-strings';
         enable = i386_pc;
         enable = i386_efi;


I have ensured that the cflags are infact getting used by gcc. I am not
sure how to resolve this.

Do you have any ideas?

Thanks,
ani
Re: bios bits for QEMU acpi tests
Posted by Ani Sinha 1 year, 10 months ago
I have gotten past this issue and I was able to successfully build
bits using the latest gcc v9.4.0 available on ubuntu 20.04.2. I have
also tested the generated iso and it seems to work fine.
I am going to clean up my changes and send PRs. Some of the changes
are bug fixes to existing code as well.

On Thu, May 19, 2022 at 4:06 PM Ani Sinha <ani@anisinha.ca> wrote:
>
> Hi Josh:
> I am looking into integrating bios bits into Qemu functional tests for
> acpi. Towards that end, I am trying to compile the code on a newer
> compiler as we might need to make some changes, for example, update acpica
> so that it can recognize newer tables etc.
>
> gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
>
>
> Since grub/python etc are quite old in the tree, on the newer copiler it
> does not build out of the box (it does however build fine on my centos 7.9
> vm with gcc version 4.8.5 20150623 (Red Hat 4.8.5-44)).
>
> I have resolved a number of issues and warnings when compiling it on the
> new version of gcc. I will at some point clean then up and share the
> changes through my github (most are cosmetic). However, there is one last
> issue which I am not
> able to get past:
>
> _GLOBAL_OFFSET_TABLE_ in python is not defined
>
> $ nm -g -P -p --undefined build/grub-build-i386-pc/grub-core/python.module
> | grep -i global
> _GLOBAL_OFFSET_TABLE_ U
>
> I have made the following change in rc/python/Makefile.core.def but with
> no help:
>
>
> --- a/rc/python/Makefile.core.def
> +++ b/rc/python/Makefile.core.def
> @@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>  module = {
>          name = python;
>          cppflags = '-I$(top_srcdir)/contrib/python -I$(srcdir)/contrib-deps/python/Include -D_IEEE_LIBM -D__LITTLE_ENDIAN= -I$(srcdir)/contrib-deps/fdlibm $(CONTRIB_CPPFLAGS) -include contrib/acpica/acenv.h -DGRUB2 -DACPI_LIBRARY -I$(top_srcdir)/contrib/acpica -I$(srcdir)/contrib-deps/acpica/source/include -U__ELF__ -I$(srcdir)/contrib-deps/libffi/include -I$(srcdir)/contrib-deps/libffi/src/x86 -I$(srcdir)/contrib-deps/python/Modules/zlib';
> -        cflags = '$(CONTRIB_CFLAGS) -fshort-wchar -maccumulate-outgoing-args -Wno-empty-body -Wno-float-equal -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-missing-declarations -Wno-missing-format-attribute -Wno-missing-noreturn -Wno-missing-prototypes -Wno-nested-externs -Wno-old-style-definition -Wno-parentheses -Wno-redundant-decls -Wno-sign-compare -Wno-shadow -Wno-shift-negative-value -Wno-type-limits -Wno-undef -Wno-uninitialized -Wno-unused -Wno-unused-parameter -Wno-unused-value -Wno-unused-variable -Wno-write-strings';
> +        cflags = '$(CONTRIB_CFLAGS) -fshort-wchar -fno-pie -no-pie -maccumulate-outgoing-args -Wno-empty-body -Wno-float-equal -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-missing-declarations -Wno-missing-format-attribute -Wno-missing-noreturn -Wno-missing-prototypes -Wno-nested-externs -Wno-old-style-definition -Wno-parentheses -Wno-redundant-decls -Wno-sign-compare -Wno-shadow -Wno-shift-negative-value -Wno-type-limits -Wno-undef -Wno-uninitialized -Wno-unused -Wno-unused-parameter -Wno-unused-value -Wno-unused-variable -Wno-write-strings';
>          enable = i386_pc;
>          enable = i386_efi;
>
>
> I have ensured that the cflags are infact getting used by gcc. I am not
> sure how to resolve this.
>
> Do you have any ideas?
>
> Thanks,
> ani
>