Skip to content

Commit

Permalink
efi/libstub: Fix gcc error around __umoddi3 for 32 bit builds
Browse files Browse the repository at this point in the history
32bit gcc doesn't support modulo operation on 64 bit data. It results in
a __umoddi3 error while building EFI for 32 bit.

Use bitwise operations instead of modulo operations to fix the issue.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Link: https://lore.kernel.org/r/20200625234516.31406-2-atish.patra@wdc.com
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
  • Loading branch information
Atish Patra authored and Ard Biesheuvel committed Jul 9, 2020
1 parent c1aac64 commit 950accb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/firmware/efi/libstub/alignedmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ efi_status_t efi_allocate_pages_aligned(unsigned long size, unsigned long *addr,
*addr = ALIGN((unsigned long)alloc_addr, align);

if (slack > 0) {
int l = (alloc_addr % align) / EFI_PAGE_SIZE;
int l = (alloc_addr & (align - 1)) / EFI_PAGE_SIZE;

if (l) {
efi_bs_call(free_pages, alloc_addr, slack - l + 1);
Expand Down

0 comments on commit 950accb

Please sign in to comment.