linuxboot / linuxboot/heads

Building coreboot for AGESA board fails

Open
#445 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Makefile
Stars
1.6k
Forks
211
Avg merge
4d 21h
Merged PRs (30d)
6

Description

(Note, the problem happens also with coreboot 4.7 in the Heads master branch. Upgrading to coreboot 4.8.1 didn’t solve it.)

Trying to add the ASRock E350M1 to Heads, the coreboot build fails with the error below (from `build/log/coreboot.log`).

```
make -C "/mnt/build/coreboot-4.8.1/asrock-e350m1" -C /mnt/build/coreboot-4.8.1 obj=/mnt/build/coreboot-4.8.1/asrock-e350m1 DOTCONFIG=../../config/coreboot-asrock-e350m1.config BUILD_TIMELESS=1 CFLAGS_x86_32=-fdebug-prefix-map=/mnt=heads -gno-record-gcc-switches CFLAGS_x86_64=-fdebug-prefix-map=/mnt=heads -gno-record-gcc-switches
[…]
LINK cbfs/fallback/bootblock.debug
OBJCOPY cbfs/fallback/bootblock.elf
OBJCOPY bootblock.raw.bin
CC libagesa/vendorcode/amd/agesa/common/amdlib.o
CC libagesa/vendorcode/amd/agesa/f14/Legacy/Proc/Dispatcher.o
CC libagesa/vendorcode/amd/agesa/f14/Legacy/Proc/agesaCallouts.o
CC libagesa/vendorcode/amd/agesa/f14/Legacy/Proc/hobTransfer.o
CC libagesa/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x14/F14C6State.o
src/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x14/F14C6State.c: In function 'F14IsC6Supported':
src/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x14/F14C6State.c:113:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
if ((((CPU_STATE_PM_CTRL1_REGISTER *) &PciRegister)->CoreC6Cap == 0) &&
^~
src/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x14/F14C6State.c:114:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
(((CPU_STATE_PM_CTRL1_REGISTER *) &PciRegister)->PkgC6Cap == 0)) {
^
src/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x14/F14C6State.c: In function 'F14InitializeC6':
src/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x14/F14C6State.c:152:5: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
if (((PSTATE_MSR *) &MsrReg)->PsEnable == 1) {
^~
src/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x14/F14C6State.c:163:5: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
((CPU_STATE_PM_CTRL1_REGISTER *) &PciRegister)->CoreC6Dis = 0;
^
src/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x14/F14C6State.c:164:5: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
((CPU_STATE_PM_CTRL1_REGISTER *) &PciRegister)->PkgC6Dis = 0;
^
src/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x14/F14C6State.c:173:5: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
ASSERT (((MEM_CFG_LOW_REGISTER *) &PciRegister)->C6DramLock == 1);
^~~~~~
src/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x14/F14C6State.c:177:5: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
ASSERT (((C6_BASE_REGISTER *) &PciRegister)->C6Base != 0);
^~~~~~
src/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x14/F14C6State.c:184:5: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
if (((CPU_STATE_PM_CTRL1_REGISTER *) &PciRegister)->PkgC6Cap == 1) {
^~
src/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x14/F14C6State.c:185:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
((CPU_STATE_PM_CTRL1_REGISTER *) &PciRegister)->PstateIdCoreOffExit = MaxEnabledPstate;
^
cc1: all warnings being treated as errors
make[1]: *** [Makefile:338: asrock-e350m1/libagesa/vendorcode/amd/agesa/f14/Proc/CPU/Family/0x14/F14C6State.o] Error 1
make[1]: Leaving directory '/mnt/build/coreboot-4.8.1'
```

The problem seems to be, that the CFLAGS for AGESA or somehow ignored.

The main `Makefile.inc` enables the warning.

Makefile.inc:CFLAGS_common += -Wstrict-aliasing -Wshadow -Wdate-time

But in `src/vendorcode/amd/agesa/f14/Makefile.inc` there is:

CFLAGS_x86_32 += -march=k8-sse3 -mtune=k8-sse3 -fno-zero-initialized-in-bss -fno-strict-aliasing
CFLAGS_x86_64 += -march=k8-sse3 -mtune=k8-sse3 -fno-zero-initialized-in-bss -fno-strict-aliasing

Building coreboot manually, works fine.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/vendorcode/amd/agesa/f14/Makefile.inc and the main Makefile.inc, then inspect the Heads build command in build/log/coreboot.log. Compare the CFLAGS used by the Heads build with those from a successful manual coreboot build. Done means the ASRock E350M1 target builds without the strict-aliasing errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.