Blame SOURCES/0242-cleanup-grub_cpu_to_XXX_compile_time-for-constants.patch

d41074
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
a85e8e
From: Andrey Borzenkov <arvidjaar@gmail.com>
a85e8e
Date: Mon, 22 Sep 2014 20:47:10 +0400
d41074
Subject: [PATCH] cleanup: grub_cpu_to_XXX_compile_time for constants
a85e8e
a85e8e
This tries to catch all cases where grub_cpu_to_XXX was used for constant
a85e8e
expressions (including sizeof).
a85e8e
---
a85e8e
 grub-core/bus/usb/ehci.c         | 44 ++++++++++++++++++++--------------------
a85e8e
 grub-core/bus/usb/ohci.c         |  8 ++++----
a85e8e
 grub-core/commands/gptsync.c     |  6 +++---
a85e8e
 grub-core/disk/mdraid_linux.c    | 12 +++++------
a85e8e
 grub-core/disk/scsi.c            |  2 +-
a85e8e
 grub-core/disk/usbms.c           |  4 ++--
a85e8e
 grub-core/fs/hfs.c               |  2 +-
a85e8e
 grub-core/fs/reiserfs.c          | 12 +++++------
a85e8e
 grub-core/lib/fdt.c              | 12 +++++------
a85e8e
 grub-core/loader/i386/linux.c    |  2 +-
a85e8e
 grub-core/loader/i386/pc/linux.c | 12 +++++------
a85e8e
 grub-core/loader/i386/xen_file.c |  4 ++--
a85e8e
 grub-core/net/arp.c              |  4 ++--
a85e8e
 grub-core/net/bootp.c            |  4 ++--
a85e8e
 grub-core/net/ip.c               |  2 +-
a85e8e
 grub-core/net/net.c              |  2 +-
a85e8e
 grub-core/net/tftp.c             |  8 ++++----
a85e8e
 grub-core/partmap/acorn.c        |  4 ++--
a85e8e
 grub-core/partmap/bsdlabel.c     |  2 +-
a85e8e
 grub-core/partmap/gpt.c          |  2 +-
a85e8e
 grub-core/partmap/msdos.c        |  4 ++--
a85e8e
 grub-core/tests/video_checksum.c |  6 +++---
a85e8e
 util/grub-mkfont.c               |  4 ++--
a85e8e
 util/grub-mklayout.c             |  2 +-
a85e8e
 util/mkimage.c                   | 15 +++++++-------
a85e8e
 25 files changed, 90 insertions(+), 89 deletions(-)
a85e8e
a85e8e
diff --git a/grub-core/bus/usb/ehci.c b/grub-core/bus/usb/ehci.c
d41074
index c0feefafe4a..8ece40086ec 100644
a85e8e
--- a/grub-core/bus/usb/ehci.c
a85e8e
+++ b/grub-core/bus/usb/ehci.c
a85e8e
@@ -670,23 +670,23 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid,
a85e8e
   for (i = 0; i < (GRUB_EHCI_N_TD - 1); i++)
a85e8e
     {
a85e8e
       e->td_virt[i].link_td = e->td_phys + (i + 1) * sizeof (struct grub_ehci_td);
a85e8e
-      e->td_virt[i].next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
a85e8e
-      e->td_virt[i].alt_next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
a85e8e
+      e->td_virt[i].next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
a85e8e
+      e->td_virt[i].alt_next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
a85e8e
     }
a85e8e
   e->td_virt[GRUB_EHCI_N_TD - 1].next_td =
a85e8e
-    grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
a85e8e
+    grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
a85e8e
   e->td_virt[GRUB_EHCI_N_TD - 1].alt_next_td =
a85e8e
-    grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
a85e8e
+    grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
a85e8e
   e->tdfree_virt = e->td_virt;
a85e8e
   /* Set Terminate in first QH, which is used in framelist */
a85e8e
-  e->qh_virt[0].qh_hptr = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE | GRUB_EHCI_HPTR_TYPE_QH);
a85e8e
-  e->qh_virt[0].td_overlay.next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
a85e8e
+  e->qh_virt[0].qh_hptr = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE | GRUB_EHCI_HPTR_TYPE_QH);
a85e8e
+  e->qh_virt[0].td_overlay.next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
a85e8e
   e->qh_virt[0].td_overlay.alt_next_td =
a85e8e
-    grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
a85e8e
+    grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
a85e8e
   /* Also set Halted bit in token */
a85e8e
-  e->qh_virt[0].td_overlay.token = grub_cpu_to_le32 (GRUB_EHCI_STATUS_HALTED);
a85e8e
+  e->qh_virt[0].td_overlay.token = grub_cpu_to_le32_compile_time (GRUB_EHCI_STATUS_HALTED);
a85e8e
   /* Set the H bit in first QH used for AL */
a85e8e
-  e->qh_virt[1].ep_char = grub_cpu_to_le32 (GRUB_EHCI_H);
a85e8e
+  e->qh_virt[1].ep_char = grub_cpu_to_le32_compile_time (GRUB_EHCI_H);
a85e8e
   /* Set Terminate into TD in rest of QHs and set horizontal link
a85e8e
    * pointer to itself - these QHs will be used for asynchronous
a85e8e
    * schedule and they should have valid value in horiz. link */
a85e8e
@@ -697,12 +697,12 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid,
a85e8e
 						e->qh_chunk) &
a85e8e
 			   GRUB_EHCI_POINTER_MASK) | GRUB_EHCI_HPTR_TYPE_QH);
a85e8e
       e->qh_virt[i].td_overlay.next_td =
a85e8e
-	grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
a85e8e
+	grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
a85e8e
       e->qh_virt[i].td_overlay.alt_next_td =
a85e8e
-	grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
a85e8e
+	grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
a85e8e
       /* Also set Halted bit in token */
a85e8e
       e->qh_virt[i].td_overlay.token =
a85e8e
-	grub_cpu_to_le32 (GRUB_EHCI_STATUS_HALTED);
a85e8e
+	grub_cpu_to_le32_compile_time (GRUB_EHCI_STATUS_HALTED);
a85e8e
     }
a85e8e
 
a85e8e
   /* Note: QH 0 and QH 1 are reserved and must not be used anywhere.
a85e8e
@@ -991,7 +991,7 @@ grub_ehci_find_qh (struct grub_ehci *e, grub_usb_transfer_t transfer)
a85e8e
   target = ((transfer->endpoint << GRUB_EHCI_EP_NUM_OFF) |
a85e8e
 	    transfer->devaddr) & GRUB_EHCI_TARGET_MASK;
a85e8e
   target = grub_cpu_to_le32 (target);
a85e8e
-  mask = grub_cpu_to_le32 (GRUB_EHCI_TARGET_MASK);
a85e8e
+  mask = grub_cpu_to_le32_compile_time (GRUB_EHCI_TARGET_MASK);
a85e8e
 
a85e8e
   /* low speed interrupt transfers are linked to the periodic */
a85e8e
   /* schedule, everything else to the asynchronous schedule */
a85e8e
@@ -1200,7 +1200,7 @@ grub_ehci_transaction (struct grub_ehci *e,
a85e8e
   grub_memset ((void *) td, 0, sizeof (struct grub_ehci_td));
a85e8e
 
a85e8e
   /* Don't point to any TD yet, just terminate.  */
a85e8e
-  td->next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
a85e8e
+  td->next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
a85e8e
   /* Set alternate pointer. When short packet occurs, alternate TD
a85e8e
    * will not be really fetched because it is not active. But don't
a85e8e
    * forget, EHCI will try to fetch alternate TD every scan of AL
a85e8e
@@ -1325,9 +1325,9 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev,
a85e8e
   /* Fill whole alternate TD by zeros (= inactive) and set
a85e8e
    * Terminate bits and Halt bit */
a85e8e
   grub_memset ((void *) cdata->td_alt_virt, 0, sizeof (struct grub_ehci_td));
a85e8e
-  cdata->td_alt_virt->next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
a85e8e
-  cdata->td_alt_virt->alt_next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
a85e8e
-  cdata->td_alt_virt->token = grub_cpu_to_le32 (GRUB_EHCI_STATUS_HALTED);
a85e8e
+  cdata->td_alt_virt->next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
a85e8e
+  cdata->td_alt_virt->alt_next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
a85e8e
+  cdata->td_alt_virt->token = grub_cpu_to_le32_compile_time (GRUB_EHCI_STATUS_HALTED);
a85e8e
 
a85e8e
   /* Allocate appropriate number of TDs and set */
a85e8e
   for (i = 0; i < transfer->transcnt; i++)
a85e8e
@@ -1364,7 +1364,7 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev,
a85e8e
   cdata->td_last_virt = td;
a85e8e
   cdata->td_last_phys = grub_dma_virt2phys (td, e->td_chunk);
a85e8e
   /* Last TD should not have set alternate TD */
a85e8e
-  cdata->td_last_virt->alt_next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
a85e8e
+  cdata->td_last_virt->alt_next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
a85e8e
 
a85e8e
   grub_dprintf ("ehci", "setup_transfer: cdata=%p, qh=%p\n",
a85e8e
 		cdata,cdata->qh_virt);
a85e8e
@@ -1377,14 +1377,14 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev,
a85e8e
   /* Start transfer: */
a85e8e
   /* Unlink possible alternate pointer in QH */
a85e8e
   cdata->qh_virt->td_overlay.alt_next_td =
a85e8e
-    grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
a85e8e
+    grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
a85e8e
   /* Link new TDs with QH via next_td */
a85e8e
   cdata->qh_virt->td_overlay.next_td =
a85e8e
     grub_cpu_to_le32 (grub_dma_virt2phys
a85e8e
 		      (cdata->td_first_virt, e->td_chunk));
a85e8e
   /* Reset Active and Halted bits in QH to activate Advance Queue,
a85e8e
    * i.e. reset token */
a85e8e
-  cdata->qh_virt->td_overlay.token = grub_cpu_to_le32 (0);
a85e8e
+  cdata->qh_virt->td_overlay.token = grub_cpu_to_le32_compile_time (0);
a85e8e
 
a85e8e
   /* Finito */
a85e8e
   transfer->controller_data = cdata;
a85e8e
@@ -1408,9 +1408,9 @@ grub_ehci_pre_finish_transfer (grub_usb_transfer_t transfer)
a85e8e
    * safely manipulate with QH TD part. */
a85e8e
   cdata->qh_virt->td_overlay.token = (cdata->qh_virt->td_overlay.token
a85e8e
 				      |
a85e8e
-				      grub_cpu_to_le32
a85e8e
+				      grub_cpu_to_le32_compile_time
a85e8e
 				      (GRUB_EHCI_STATUS_HALTED)) &
a85e8e
-    grub_cpu_to_le32 (~GRUB_EHCI_STATUS_ACTIVE);
a85e8e
+    grub_cpu_to_le32_compile_time (~GRUB_EHCI_STATUS_ACTIVE);
a85e8e
 
a85e8e
   /* Print debug data here if necessary */
a85e8e
 
a85e8e
diff --git a/grub-core/bus/usb/ohci.c b/grub-core/bus/usb/ohci.c
d41074
index 946a4ed7d5b..d27bfe7fb9d 100644
a85e8e
--- a/grub-core/bus/usb/ohci.c
a85e8e
+++ b/grub-core/bus/usb/ohci.c
a85e8e
@@ -314,7 +314,7 @@ grub_ohci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid,
a85e8e
   grub_memset ((void *) o->ed_ctrl, 0, sizeof (struct grub_ohci_ed)
a85e8e
 	       * GRUB_OHCI_CTRL_EDS);
a85e8e
   for (j=0; j < GRUB_OHCI_CTRL_EDS; j++)
a85e8e
-    o->ed_ctrl[j].target = grub_cpu_to_le32 (1 << 14); /* skip */
a85e8e
+    o->ed_ctrl[j].target = grub_cpu_to_le32_compile_time (1 << 14); /* skip */
a85e8e
     
a85e8e
   grub_dprintf ("ohci", "EDs-C: chunk=%p, virt=%p, phys=0x%02x\n",
a85e8e
                 o->ed_ctrl_chunk, o->ed_ctrl, o->ed_ctrl_addr);
a85e8e
@@ -329,7 +329,7 @@ grub_ohci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid,
a85e8e
   /* Preset EDs */
a85e8e
   grub_memset ((void*)o->ed_bulk, 0, sizeof(struct grub_ohci_ed) * GRUB_OHCI_BULK_EDS);
a85e8e
   for (j=0; j < GRUB_OHCI_BULK_EDS; j++)
a85e8e
-    o->ed_bulk[j].target = grub_cpu_to_le32 (1 << 14); /* skip */
a85e8e
+    o->ed_bulk[j].target = grub_cpu_to_le32_compile_time (1 << 14); /* skip */
a85e8e
 
a85e8e
   grub_dprintf ("ohci", "EDs-B: chunk=%p, virt=%p, phys=0x%02x\n",
a85e8e
                 o->ed_bulk_chunk, o->ed_bulk, o->ed_bulk_addr);
a85e8e
@@ -1349,10 +1349,10 @@ grub_ohci_fini_hw (int noreturn __attribute__ ((unused)))
a85e8e
       /* Set skip in all EDs */
a85e8e
       if (o->ed_bulk)
a85e8e
         for (i=0; i < GRUB_OHCI_BULK_EDS; i++)
a85e8e
-          o->ed_bulk[i].target |= grub_cpu_to_le32 (1 << 14); /* skip */
a85e8e
+          o->ed_bulk[i].target |= grub_cpu_to_le32_compile_time (1 << 14); /* skip */
a85e8e
       if (o->ed_ctrl)
a85e8e
         for (i=0; i < GRUB_OHCI_CTRL_EDS; i++)
a85e8e
-          o->ed_ctrl[i].target |= grub_cpu_to_le32 (1 << 14); /* skip */
a85e8e
+          o->ed_ctrl[i].target |= grub_cpu_to_le32_compile_time (1 << 14); /* skip */
a85e8e
 
a85e8e
       /* We should wait for next SOF to be sure that all EDs are
a85e8e
        * unaccessed by OHCI. But OHCI can be non-functional, so
a85e8e
diff --git a/grub-core/commands/gptsync.c b/grub-core/commands/gptsync.c
d41074
index 3db62887b92..16592e9bbe8 100644
a85e8e
--- a/grub-core/commands/gptsync.c
a85e8e
+++ b/grub-core/commands/gptsync.c
a85e8e
@@ -101,7 +101,7 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
a85e8e
     }
a85e8e
 
a85e8e
   /* Check if it is valid.  */
a85e8e
-  if (mbr.signature != grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE))
a85e8e
+  if (mbr.signature != grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE))
a85e8e
     {
a85e8e
       grub_device_close (dev);
a85e8e
       return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature");
a85e8e
@@ -216,7 +216,7 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
a85e8e
     first_sector--;
a85e8e
   mbr.entries[0].flag = 0;
a85e8e
   mbr.entries[0].type = GRUB_PC_PARTITION_TYPE_GPT_DISK;
a85e8e
-  mbr.entries[0].start = grub_cpu_to_le32 (1);
a85e8e
+  mbr.entries[0].start = grub_cpu_to_le32_compile_time (1);
a85e8e
   lba_to_chs (1,
a85e8e
 	      &(mbr.entries[0].start_sector),
a85e8e
 	      &(mbr.entries[0].start_cylinder),
a85e8e
@@ -227,7 +227,7 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
a85e8e
 	      &(mbr.entries[0].end_head));
a85e8e
   mbr.entries[0].length = grub_cpu_to_le32 (first_sector);
a85e8e
 
a85e8e
-  mbr.signature = grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE);
a85e8e
+  mbr.signature = grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE);
a85e8e
 
a85e8e
   if (grub_disk_write (dev->disk, 0, 0, sizeof (mbr), &mbr))
a85e8e
     {
a85e8e
diff --git a/grub-core/disk/mdraid_linux.c b/grub-core/disk/mdraid_linux.c
d41074
index 4aa5882352e..11024ae31e0 100644
a85e8e
--- a/grub-core/disk/mdraid_linux.c
a85e8e
+++ b/grub-core/disk/mdraid_linux.c
a85e8e
@@ -33,16 +33,16 @@ GRUB_MOD_LICENSE ("GPLv3+");
a85e8e
 #define grub_md_to_cpu64 grub_be_to_cpu64
a85e8e
 #define grub_md_to_cpu32 grub_be_to_cpu32
a85e8e
 #define grub_md_to_cpu16 grub_be_to_cpu16
a85e8e
-#define grub_cpu_to_md64_compile_time grub_cpu_to_be64
a85e8e
-#define grub_cpu_to_md32_compile_time grub_cpu_to_be32
a85e8e
-#define grub_cpu_to_md16_compile_time grub_cpu_to_be16
a85e8e
+#define grub_cpu_to_md64_compile_time grub_cpu_to_be64_compile_time
a85e8e
+#define grub_cpu_to_md32_compile_time grub_cpu_to_be32_compile_time
a85e8e
+#define grub_cpu_to_md16_compile_time grub_cpu_to_be16_compile_time
a85e8e
 #else
a85e8e
 #define grub_md_to_cpu64 grub_le_to_cpu64
a85e8e
 #define grub_md_to_cpu32 grub_le_to_cpu32
a85e8e
 #define grub_md_to_cpu16 grub_le_to_cpu16
a85e8e
-#define grub_cpu_to_md64_compile_time grub_cpu_to_le64
a85e8e
-#define grub_cpu_to_md32_compile_time grub_cpu_to_le32
a85e8e
-#define grub_cpu_to_md16_compile_time grub_cpu_to_le16
a85e8e
+#define grub_cpu_to_md64_compile_time grub_cpu_to_le64_compile_time
a85e8e
+#define grub_cpu_to_md32_compile_time grub_cpu_to_le32_compile_time
a85e8e
+#define grub_cpu_to_md16_compile_time grub_cpu_to_le16_compile_time
a85e8e
 #endif
a85e8e
 
a85e8e
 #define RESERVED_BYTES			(64 * 1024)
a85e8e
diff --git a/grub-core/disk/scsi.c b/grub-core/disk/scsi.c
d41074
index b6cb2f42109..92084d0f8ed 100644
a85e8e
--- a/grub-core/disk/scsi.c
a85e8e
+++ b/grub-core/disk/scsi.c
a85e8e
@@ -201,7 +201,7 @@ grub_scsi_read_capacity16 (grub_scsi_t scsi)
a85e8e
   rc.opcode = grub_scsi_cmd_read_capacity16;
a85e8e
   rc.lun = (scsi->lun << GRUB_SCSI_LUN_SHIFT) | 0x10;
a85e8e
   rc.logical_block_addr = 0;
a85e8e
-  rc.alloc_len = grub_cpu_to_be32 (sizeof (rcd));
a85e8e
+  rc.alloc_len = grub_cpu_to_be32_compile_time (sizeof (rcd));
a85e8e
   rc.PMI = 0;
a85e8e
   rc.control = 0;
a85e8e
 	
a85e8e
diff --git a/grub-core/disk/usbms.c b/grub-core/disk/usbms.c
d41074
index 2b769bdd8e1..380ca4c4cbf 100644
a85e8e
--- a/grub-core/disk/usbms.c
a85e8e
+++ b/grub-core/disk/usbms.c
a85e8e
@@ -307,7 +307,7 @@ grub_usbms_transfer_bo (struct grub_scsi *scsi, grub_size_t cmdsize, char *cmd,
a85e8e
 
a85e8e
   /* Setup the request.  */
a85e8e
   grub_memset (&cbw, 0, sizeof (cbw));
a85e8e
-  cbw.signature = grub_cpu_to_le32 (0x43425355);
a85e8e
+  cbw.signature = grub_cpu_to_le32_compile_time (0x43425355);
a85e8e
   cbw.tag = tag;
a85e8e
   cbw.transfer_length = grub_cpu_to_le32 (size);
a85e8e
   cbw.flags = (!read_write) << GRUB_USBMS_DIRECTION_BIT;
a85e8e
@@ -414,7 +414,7 @@ CheckCSW:
a85e8e
   
a85e8e
   /* If phase error or not valid signature, do bulk-only reset device. */
a85e8e
   if ((status.status == 2) ||
a85e8e
-      (status.signature != grub_cpu_to_le32(0x53425355)))
a85e8e
+      (status.signature != grub_cpu_to_le32_compile_time(0x53425355)))
a85e8e
     { /* Bulk-only reset device. */
a85e8e
       grub_dprintf ("usb", "Bulk-only reset device - bad status\n");
a85e8e
       grub_usbms_reset (dev);
a85e8e
diff --git a/grub-core/fs/hfs.c b/grub-core/fs/hfs.c
d41074
index 1e593059a74..d1dc015455d 100644
a85e8e
--- a/grub-core/fs/hfs.c
a85e8e
+++ b/grub-core/fs/hfs.c
a85e8e
@@ -369,7 +369,7 @@ grub_hfs_mount (grub_disk_t disk)
a85e8e
 
a85e8e
   /* Lookup the root directory node in the catalog tree using the
a85e8e
      volume name.  */
a85e8e
-  key.parent_dir = grub_cpu_to_be32 (1);
a85e8e
+  key.parent_dir = grub_cpu_to_be32_compile_time (1);
a85e8e
   key.strlen = data->sblock.volname[0];
a85e8e
   grub_strcpy ((char *) key.str, (char *) (data->sblock.volname + 1));
a85e8e
 
a85e8e
diff --git a/grub-core/fs/reiserfs.c b/grub-core/fs/reiserfs.c
d41074
index ac65054d363..de3d4fa3c64 100644
a85e8e
--- a/grub-core/fs/reiserfs.c
a85e8e
+++ b/grub-core/fs/reiserfs.c
a85e8e
@@ -365,7 +365,7 @@ grub_reiserfs_set_key_offset (struct grub_reiserfs_key *key,
a85e8e
     key->u.v1.offset = grub_cpu_to_le32 (value);
a85e8e
   else
a85e8e
     key->u.v2.offset_type \
a85e8e
-      = ((key->u.v2.offset_type & grub_cpu_to_le64 (15ULL << 60))
a85e8e
+      = ((key->u.v2.offset_type & grub_cpu_to_le64_compile_time (15ULL << 60))
a85e8e
          | grub_cpu_to_le64 (value & (~0ULL >> 4)));
a85e8e
 }
a85e8e
 
a85e8e
@@ -412,7 +412,7 @@ grub_reiserfs_set_key_type (struct grub_reiserfs_key *key,
a85e8e
     key->u.v1.type = grub_cpu_to_le32 (type);
a85e8e
   else
a85e8e
     key->u.v2.offset_type
a85e8e
-      = ((key->u.v2.offset_type & grub_cpu_to_le64 (~0ULL >> 4))
a85e8e
+      = ((key->u.v2.offset_type & grub_cpu_to_le64_compile_time (~0ULL >> 4))
a85e8e
          | grub_cpu_to_le64 ((grub_uint64_t) type << 60));
a85e8e
 
a85e8e
   assert (grub_reiserfs_get_key_type (key) == grub_type);
a85e8e
@@ -997,8 +997,8 @@ grub_reiserfs_open (struct grub_file *file, const char *name)
a85e8e
   data = grub_reiserfs_mount (file->device->disk);
a85e8e
   if (! data)
a85e8e
     goto fail;
a85e8e
-  key.directory_id = grub_cpu_to_le32 (1);
a85e8e
-  key.object_id = grub_cpu_to_le32 (2);
a85e8e
+  key.directory_id = grub_cpu_to_le32_compile_time (1);
a85e8e
+  key.object_id = grub_cpu_to_le32_compile_time (2);
a85e8e
   key.u.v2.offset_type = 0;
a85e8e
   grub_reiserfs_set_key_type (&key, GRUB_REISERFS_DIRECTORY, 2);
a85e8e
   grub_reiserfs_set_key_offset (&key, 1);
a85e8e
@@ -1289,8 +1289,8 @@ grub_reiserfs_dir (grub_device_t device, const char *path,
a85e8e
   data = grub_reiserfs_mount (device->disk);
a85e8e
   if (! data)
a85e8e
     goto fail;
a85e8e
-  root_key.directory_id = grub_cpu_to_le32 (1);
a85e8e
-  root_key.object_id = grub_cpu_to_le32 (2);
a85e8e
+  root_key.directory_id = grub_cpu_to_le32_compile_time (1);
a85e8e
+  root_key.object_id = grub_cpu_to_le32_compile_time (2);
a85e8e
   root_key.u.v2.offset_type = 0;
a85e8e
   grub_reiserfs_set_key_type (&root_key, GRUB_REISERFS_DIRECTORY, 2);
a85e8e
   grub_reiserfs_set_key_offset (&root_key, 1);
a85e8e
diff --git a/grub-core/lib/fdt.c b/grub-core/lib/fdt.c
d41074
index 907a7bff61f..7e76dc06bbc 100644
a85e8e
--- a/grub-core/lib/fdt.c
a85e8e
+++ b/grub-core/lib/fdt.c
a85e8e
@@ -164,10 +164,10 @@ static int add_subnode (void *fdt, int parentoffset, const char *name)
a85e8e
 insert:
a85e8e
   grub_memmove (token + entry_size / sizeof(*token), token,
a85e8e
                 (grub_addr_t) end - (grub_addr_t) token);
a85e8e
-  *token = grub_cpu_to_be32(FDT_BEGIN_NODE);
a85e8e
+  *token = grub_cpu_to_be32_compile_time(FDT_BEGIN_NODE);
a85e8e
   token[entry_size / sizeof(*token) - 2] = 0;	/* padding bytes */
a85e8e
   grub_strcpy((char *) (token + 1), name);
a85e8e
-  token[entry_size / sizeof(*token) - 1] = grub_cpu_to_be32(FDT_END_NODE);
a85e8e
+  token[entry_size / sizeof(*token) - 1] = grub_cpu_to_be32_compile_time(FDT_END_NODE);
a85e8e
   grub_fdt_set_size_dt_struct (fdt, struct_size + entry_size);
a85e8e
   return ((grub_addr_t) token - (grub_addr_t) fdt
a85e8e
           - grub_fdt_get_off_dt_struct(fdt));
a85e8e
@@ -377,7 +377,7 @@ int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name,
a85e8e
 
a85e8e
       prop_name_present = 1;
a85e8e
 	  for (i = 0; i < prop_len / sizeof(grub_uint32_t); i++)
a85e8e
-        *(prop + 3 + i) = grub_cpu_to_be32 (FDT_NOP);
a85e8e
+        *(prop + 3 + i) = grub_cpu_to_be32_compile_time (FDT_NOP);
a85e8e
       if (len > ALIGN_UP(prop_len, sizeof(grub_uint32_t)))
a85e8e
         {
a85e8e
           /* Length of new property value is greater than the space allocated
a85e8e
@@ -385,7 +385,7 @@ int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name,
a85e8e
              nameoff field of the current entry and replace the current entry
a85e8e
              with NOP tokens. */
a85e8e
           nameoff = grub_be_to_cpu32 (*(prop + 2));
a85e8e
-    	  *prop = *(prop + 1) = *(prop + 2) = grub_cpu_to_be32 (FDT_NOP);
a85e8e
+          *prop = *(prop + 1) = *(prop + 2) = grub_cpu_to_be32_compile_time (FDT_NOP);
a85e8e
           prop = NULL;
a85e8e
         }
a85e8e
     }
a85e8e
@@ -419,7 +419,7 @@ int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name,
a85e8e
                   struct_end(fdt) - (grub_addr_t) prop);
a85e8e
     grub_fdt_set_size_dt_struct (fdt, grub_fdt_get_size_dt_struct (fdt)
a85e8e
                                  + prop_entry_size(len));
a85e8e
-    *prop = grub_cpu_to_be32 (FDT_PROP);
a85e8e
+    *prop = grub_cpu_to_be32_compile_time (FDT_PROP);
a85e8e
     *(prop + 2) = grub_cpu_to_be32 (nameoff);
a85e8e
   }
a85e8e
   *(prop + 1) = grub_cpu_to_be32 (len);
a85e8e
@@ -447,7 +447,7 @@ grub_fdt_create_empty_tree (void *fdt, unsigned int size)
a85e8e
   et->empty_node.node_end = grub_cpu_to_be32_compile_time (FDT_END_NODE);
a85e8e
   et->empty_node.node_start = grub_cpu_to_be32_compile_time (FDT_BEGIN_NODE);
a85e8e
   ((struct grub_fdt_empty_tree *) fdt)->header.off_mem_rsvmap =
a85e8e
-    grub_cpu_to_be32 (ALIGN_UP (sizeof (grub_fdt_header_t), 8));
a85e8e
+    grub_cpu_to_be32_compile_time (ALIGN_UP (sizeof (grub_fdt_header_t), 8));
a85e8e
 
a85e8e
   grub_fdt_set_off_dt_strings (fdt, sizeof (*et));
a85e8e
   grub_fdt_set_off_dt_struct (fdt,
a85e8e
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
d41074
index 764cde20318..e3906eb658f 100644
a85e8e
--- a/grub-core/loader/i386/linux.c
a85e8e
+++ b/grub-core/loader/i386/linux.c
a85e8e
@@ -734,7 +734,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
a85e8e
 
a85e8e
   /* FIXME: 2.03 is not always good enough (Linux 2.4 can be 2.03 and
a85e8e
      still not support 32-bit boot.  */
a85e8e
-  if (lh.header != grub_cpu_to_le32 (GRUB_LINUX_MAGIC_SIGNATURE)
a85e8e
+  if (lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE)
a85e8e
       || grub_le_to_cpu16 (lh.version) < 0x0203)
a85e8e
     {
a85e8e
       grub_error (GRUB_ERR_BAD_OS, "version too old for 32-bit boot"
a85e8e
diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c
d41074
index 60bb31fbf0d..c2e5fa9abcc 100644
a85e8e
--- a/grub-core/loader/i386/pc/linux.c
a85e8e
+++ b/grub-core/loader/i386/pc/linux.c
a85e8e
@@ -201,7 +201,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
a85e8e
 
a85e8e
       if (grub_le_to_cpu16 (lh.version) >= 0x0201)
a85e8e
 	{
a85e8e
-	  lh.heap_end_ptr = grub_cpu_to_le32_compile_time (GRUB_LINUX_HEAP_END_OFFSET);
a85e8e
+	  lh.heap_end_ptr = grub_cpu_to_le16_compile_time (GRUB_LINUX_HEAP_END_OFFSET);
a85e8e
 	  lh.loadflags |= GRUB_LINUX_FLAG_CAN_USE_HEAP;
a85e8e
 	}
a85e8e
 
a85e8e
@@ -209,17 +209,17 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
a85e8e
 	lh.cmd_line_ptr = grub_linux_real_target + GRUB_LINUX_CL_OFFSET;
a85e8e
       else
a85e8e
 	{
a85e8e
-	  lh.cl_magic = grub_cpu_to_le32_compile_time (GRUB_LINUX_CL_MAGIC);
a85e8e
-	  lh.cl_offset = grub_cpu_to_le32_compile_time (GRUB_LINUX_CL_OFFSET);
a85e8e
-	  lh.setup_move_size = grub_cpu_to_le32_compile_time (GRUB_LINUX_CL_OFFSET
a85e8e
+	  lh.cl_magic = grub_cpu_to_le16_compile_time (GRUB_LINUX_CL_MAGIC);
a85e8e
+	  lh.cl_offset = grub_cpu_to_le16_compile_time (GRUB_LINUX_CL_OFFSET);
a85e8e
+	  lh.setup_move_size = grub_cpu_to_le16_compile_time (GRUB_LINUX_CL_OFFSET
a85e8e
 						 + maximal_cmdline_size);
a85e8e
 	}
a85e8e
     }
a85e8e
   else
a85e8e
     {
a85e8e
       /* Your kernel is quite old...  */
a85e8e
-      lh.cl_magic = grub_cpu_to_le32_compile_time (GRUB_LINUX_CL_MAGIC);
a85e8e
-      lh.cl_offset = grub_cpu_to_le32_compile_time (GRUB_LINUX_CL_OFFSET);
a85e8e
+      lh.cl_magic = grub_cpu_to_le16_compile_time (GRUB_LINUX_CL_MAGIC);
a85e8e
+      lh.cl_offset = grub_cpu_to_le16_compile_time (GRUB_LINUX_CL_OFFSET);
a85e8e
 
a85e8e
       setup_sects = GRUB_LINUX_DEFAULT_SETUP_SECTS;
a85e8e
 
a85e8e
diff --git a/grub-core/loader/i386/xen_file.c b/grub-core/loader/i386/xen_file.c
d41074
index ff23235f064..58362189098 100644
a85e8e
--- a/grub-core/loader/i386/xen_file.c
a85e8e
+++ b/grub-core/loader/i386/xen_file.c
a85e8e
@@ -38,8 +38,8 @@ grub_xen_file (grub_file_t file)
a85e8e
   if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh))
a85e8e
     goto fail;
a85e8e
 
a85e8e
-  if (lh.boot_flag != grub_cpu_to_le16 (0xaa55)
a85e8e
-      || lh.header != grub_cpu_to_le32 (GRUB_LINUX_MAGIC_SIGNATURE)
a85e8e
+  if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55)
a85e8e
+      || lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE)
a85e8e
       || grub_le_to_cpu16 (lh.version) < 0x0208)
a85e8e
     {
a85e8e
       grub_error (GRUB_ERR_BAD_OS, "version too old for xen boot");
a85e8e
diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c
d41074
index d62d0cc1e01..8cc390b0e28 100644
a85e8e
--- a/grub-core/net/arp.c
a85e8e
+++ b/grub-core/net/arp.c
a85e8e
@@ -81,11 +81,11 @@ grub_net_arp_send_request (struct grub_net_network_level_interface *inf,
a85e8e
     return err;
a85e8e
 
a85e8e
   arp_header = (struct arphdr *) nb.data;
a85e8e
-  arp_header->hrd = grub_cpu_to_be16 (GRUB_NET_ARPHRD_ETHERNET);
a85e8e
+  arp_header->hrd = grub_cpu_to_be16_compile_time (GRUB_NET_ARPHRD_ETHERNET);
a85e8e
   arp_header->hln = 6;
a85e8e
   arp_header->pro = grub_cpu_to_be16 (etherpro);
a85e8e
   arp_header->pln = addrlen;
a85e8e
-  arp_header->op = grub_cpu_to_be16 (ARP_REQUEST);
a85e8e
+  arp_header->op = grub_cpu_to_be16_compile_time (ARP_REQUEST);
a85e8e
   aux = (grub_uint8_t *) arp_header + sizeof (*arp_header);
a85e8e
   /* Sender hardware address.  */
a85e8e
   grub_memcpy (aux, &inf->hwaddress.mac, 6);
a85e8e
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
d41074
index 46ce8135ac5..b4b8159cdad 100644
a85e8e
--- a/grub-core/net/bootp.c
a85e8e
+++ b/grub-core/net/bootp.c
a85e8e
@@ -767,8 +767,8 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)),
a85e8e
 	  grub_netbuff_push (nb, sizeof (*udph));
a85e8e
 
a85e8e
 	  udph = (struct udphdr *) nb->data;
a85e8e
-	  udph->src = grub_cpu_to_be16 (68);
a85e8e
-	  udph->dst = grub_cpu_to_be16 (67);
a85e8e
+	  udph->src = grub_cpu_to_be16_compile_time (68);
a85e8e
+	  udph->dst = grub_cpu_to_be16_compile_time (67);
a85e8e
 	  udph->chksum = 0;
a85e8e
 	  udph->len = grub_cpu_to_be16 (nb->tail - nb->data);
a85e8e
 	  target.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4;
a85e8e
diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c
d41074
index c6971f9fcd2..5a609544403 100644
a85e8e
--- a/grub-core/net/ip.c
a85e8e
+++ b/grub-core/net/ip.c
a85e8e
@@ -611,7 +611,7 @@ grub_net_send_ip6_packet (struct grub_net_network_level_interface *inf,
a85e8e
   grub_netbuff_push (nb, sizeof (*iph));
a85e8e
   iph = (struct ip6hdr *) nb->data;
a85e8e
 
a85e8e
-  iph->version_class_flow = grub_cpu_to_be32 ((6 << 28));
a85e8e
+  iph->version_class_flow = grub_cpu_to_be32_compile_time ((6 << 28));
a85e8e
   iph->len = grub_cpu_to_be16 (nb->tail - nb->data - sizeof (*iph));
a85e8e
   iph->protocol = proto;
a85e8e
   iph->ttl = 0xff;
a85e8e
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
d41074
index 36fc0d8b2e8..fc6f714bf7f 100644
a85e8e
--- a/grub-core/net/net.c
a85e8e
+++ b/grub-core/net/net.c
a85e8e
@@ -306,7 +306,7 @@ grub_net_ipv6_get_link_local (struct grub_net_card *card,
a85e8e
     return NULL;
a85e8e
 
a85e8e
   addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6;
a85e8e
-  addr.ipv6[0] = grub_cpu_to_be64 (0xfe80ULL << 48);
a85e8e
+  addr.ipv6[0] = grub_cpu_to_be64_compile_time (0xfe80ULL << 48);
a85e8e
   addr.ipv6[1] = grub_net_ipv6_get_id (hwaddr);
a85e8e
 
a85e8e
   FOR_NET_NETWORK_LEVEL_INTERFACES (inf)
a85e8e
diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
d41074
index 8632339de97..3931884c6dd 100644
a85e8e
--- a/grub-core/net/tftp.c
a85e8e
+++ b/grub-core/net/tftp.c
a85e8e
@@ -149,7 +149,7 @@ ack (tftp_data_t data, grub_uint64_t block)
a85e8e
     return err;
a85e8e
 
a85e8e
   tftph_ack = (struct tftphdr *) nb_ack.data;
a85e8e
-  tftph_ack->opcode = grub_cpu_to_be16 (TFTP_ACK);
a85e8e
+  tftph_ack->opcode = grub_cpu_to_be16_compile_time (TFTP_ACK);
a85e8e
   tftph_ack->u.ack.block = grub_cpu_to_be16 (block);
a85e8e
 
a85e8e
   err = grub_net_send_udp_packet (data->sock, &nb_ack);
a85e8e
@@ -352,7 +352,7 @@ tftp_open (struct grub_file *file, const char *filename)
a85e8e
   rrq = (char *) tftph->u.rrq;
a85e8e
   rrqlen = 0;
a85e8e
 
a85e8e
-  tftph->opcode = grub_cpu_to_be16 (TFTP_RRQ);
a85e8e
+  tftph->opcode = grub_cpu_to_be16_compile_time (TFTP_RRQ);
a85e8e
 
a85e8e
   /* Copy and normalize the filename to work-around issues on some tftp
a85e8e
      servers when file names are being matched for remapping. */
a85e8e
@@ -469,8 +469,8 @@ tftp_close (struct grub_file *file)
a85e8e
       if (!err)
a85e8e
 	{
a85e8e
 	  tftph = (struct tftphdr *) nb_err.data;
a85e8e
-	  tftph->opcode = grub_cpu_to_be16 (TFTP_ERROR);
a85e8e
-	  tftph->u.err.errcode = grub_cpu_to_be16 (TFTP_EUNDEF);
a85e8e
+	  tftph->opcode = grub_cpu_to_be16_compile_time (TFTP_ERROR);
a85e8e
+	  tftph->u.err.errcode = grub_cpu_to_be16_compile_time (TFTP_EUNDEF);
a85e8e
 	  grub_memcpy (tftph->u.err.errmsg, "closed", sizeof ("closed"));
a85e8e
 
a85e8e
 	  err = grub_net_send_udp_packet (data->sock, &nb_err);
a85e8e
diff --git a/grub-core/partmap/acorn.c b/grub-core/partmap/acorn.c
d41074
index 7bb93d9bec9..c022c61ddfc 100644
a85e8e
--- a/grub-core/partmap/acorn.c
a85e8e
+++ b/grub-core/partmap/acorn.c
a85e8e
@@ -25,8 +25,8 @@
a85e8e
 
a85e8e
 GRUB_MOD_LICENSE ("GPLv3+");
a85e8e
 
a85e8e
-#define LINUX_NATIVE_MAGIC grub_cpu_to_le32 (0xdeafa1de)
a85e8e
-#define LINUX_SWAP_MAGIC   grub_cpu_to_le32 (0xdeafab1e)
a85e8e
+#define LINUX_NATIVE_MAGIC grub_cpu_to_le32_compile_time (0xdeafa1de)
a85e8e
+#define LINUX_SWAP_MAGIC   grub_cpu_to_le32_compile_time (0xdeafab1e)
a85e8e
 #define LINUX_MAP_ENTRIES  (512 / 12)
a85e8e
 
a85e8e
 #define NONADFS_PARTITION_TYPE_LINUX 9
a85e8e
diff --git a/grub-core/partmap/bsdlabel.c b/grub-core/partmap/bsdlabel.c
d41074
index cf0f967c1fa..1d785906b6a 100644
a85e8e
--- a/grub-core/partmap/bsdlabel.c
a85e8e
+++ b/grub-core/partmap/bsdlabel.c
a85e8e
@@ -53,7 +53,7 @@ iterate_real (grub_disk_t disk, grub_disk_addr_t sector, int freebsd,
a85e8e
     return grub_errno;
a85e8e
 
a85e8e
   /* Check if it is valid.  */
a85e8e
-  if (label.magic != grub_cpu_to_le32 (GRUB_PC_PARTITION_BSD_LABEL_MAGIC))
a85e8e
+  if (label.magic != grub_cpu_to_le32_compile_time (GRUB_PC_PARTITION_BSD_LABEL_MAGIC))
a85e8e
     return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature");
a85e8e
 
a85e8e
   /* A kludge to determine a base of be.offset.  */
a85e8e
diff --git a/grub-core/partmap/gpt.c b/grub-core/partmap/gpt.c
d41074
index 38df7b3c9b8..83bcba77914 100644
a85e8e
--- a/grub-core/partmap/gpt.c
a85e8e
+++ b/grub-core/partmap/gpt.c
a85e8e
@@ -65,7 +65,7 @@ grub_gpt_partition_map_iterate (grub_disk_t disk,
a85e8e
     return grub_errno;
a85e8e
 
a85e8e
   /* Check if it is valid.  */
a85e8e
-  if (mbr.signature != grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE))
a85e8e
+  if (mbr.signature != grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE))
a85e8e
     return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature");
a85e8e
 
a85e8e
   /* Make sure the MBR is a protective MBR and not a normal MBR.  */
a85e8e
diff --git a/grub-core/partmap/msdos.c b/grub-core/partmap/msdos.c
d41074
index 1d81a53573b..46c406bff1f 100644
a85e8e
--- a/grub-core/partmap/msdos.c
a85e8e
+++ b/grub-core/partmap/msdos.c
a85e8e
@@ -162,7 +162,7 @@ grub_partition_msdos_iterate (grub_disk_t disk,
a85e8e
 	lastaddr = p.offset;
a85e8e
 
a85e8e
       /* Check if it is valid.  */
a85e8e
-      if (mbr.signature != grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE))
a85e8e
+      if (mbr.signature != grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE))
a85e8e
 	return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature");
a85e8e
 
a85e8e
       for (i = 0; i < 4; i++)
a85e8e
@@ -280,7 +280,7 @@ pc_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors,
a85e8e
 	lastaddr = offset;
a85e8e
 
a85e8e
       /* Check if it is valid.  */
a85e8e
-      if (mbr.signature != grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE))
a85e8e
+      if (mbr.signature != grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE))
a85e8e
 	return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature");
a85e8e
 
a85e8e
       for (i = 0; i < 4; i++)
a85e8e
diff --git a/grub-core/tests/video_checksum.c b/grub-core/tests/video_checksum.c
d41074
index 491bc55731c..74d5b65e5c7 100644
a85e8e
--- a/grub-core/tests/video_checksum.c
a85e8e
+++ b/grub-core/tests/video_checksum.c
a85e8e
@@ -288,16 +288,16 @@ grub_video_capture_write_bmp (const char *fname,
a85e8e
   if (mode_info->mode_type & GRUB_VIDEO_MODE_TYPE_RGB)
a85e8e
     {
a85e8e
       head.filesize = grub_cpu_to_le32 (sizeof (head) + mode_info->width * mode_info->height * 3);
a85e8e
-      head.bmp_off = grub_cpu_to_le32 (sizeof (head));
a85e8e
+      head.bmp_off = grub_cpu_to_le32_compile_time (sizeof (head));
a85e8e
       head.bpp = grub_cpu_to_le16_compile_time (24);
a85e8e
     }
a85e8e
   else
a85e8e
     {
a85e8e
       head.filesize = grub_cpu_to_le32 (sizeof (head) + 3 * 256 + mode_info->width * mode_info->height);
a85e8e
-      head.bmp_off = grub_cpu_to_le32 (sizeof (head) + 3 * 256);
a85e8e
+      head.bmp_off = grub_cpu_to_le32_compile_time (sizeof (head) + 3 * 256);
a85e8e
       head.bpp = grub_cpu_to_le16_compile_time (8);
a85e8e
     }
a85e8e
-  head.head_size = grub_cpu_to_le32 (sizeof (head) - 14);
a85e8e
+  head.head_size = grub_cpu_to_le32_compile_time (sizeof (head) - 14);
a85e8e
   head.width = grub_cpu_to_le16 (mode_info->width);
a85e8e
   head.height = grub_cpu_to_le16 (mode_info->height);
a85e8e
   head.planes = grub_cpu_to_le16_compile_time (1);
a85e8e
diff --git a/util/grub-mkfont.c b/util/grub-mkfont.c
d41074
index e6485b40f28..a0cab3a93f8 100644
a85e8e
--- a/util/grub-mkfont.c
a85e8e
+++ b/util/grub-mkfont.c
a85e8e
@@ -704,7 +704,7 @@ write_be16_section (const char *name, grub_uint16_t data, int* offset,
a85e8e
 {
a85e8e
   grub_uint32_t leng;
a85e8e
 
a85e8e
-  leng = grub_cpu_to_be32 (2);
a85e8e
+  leng = grub_cpu_to_be32_compile_time (2);
a85e8e
   data = grub_cpu_to_be16 (data);
a85e8e
   grub_util_write_image (name, 4, file, filename);
a85e8e
   grub_util_write_image ((char *) &leng, 4, file, filename);
a85e8e
@@ -801,7 +801,7 @@ write_font_pf2 (struct grub_font_info *font_info, char *output_file)
a85e8e
 
a85e8e
   offset = 0;
a85e8e
 
a85e8e
-  leng = grub_cpu_to_be32 (4);
a85e8e
+  leng = grub_cpu_to_be32_compile_time (4);
a85e8e
   grub_util_write_image (FONT_FORMAT_SECTION_NAMES_FILE,
a85e8e
   			 sizeof(FONT_FORMAT_SECTION_NAMES_FILE) - 1, file,
a85e8e
 			 output_file);
a85e8e
diff --git a/util/grub-mklayout.c b/util/grub-mklayout.c
d41074
index 692f881900b..1a4f1b4c855 100644
a85e8e
--- a/util/grub-mklayout.c
a85e8e
+++ b/util/grub-mklayout.c
a85e8e
@@ -329,7 +329,7 @@ write_file (FILE *out, const char *fname, struct grub_keyboard_layout *layout)
a85e8e
   grub_uint32_t version;
a85e8e
   unsigned i;
a85e8e
 
a85e8e
-  version = grub_cpu_to_le32 (GRUB_KEYBOARD_LAYOUTS_VERSION);
a85e8e
+  version = grub_cpu_to_le32_compile_time (GRUB_KEYBOARD_LAYOUTS_VERSION);
a85e8e
   
a85e8e
   for (i = 0; i < ARRAY_SIZE (layout->keyboard_map); i++)
a85e8e
     layout->keyboard_map[i] = grub_cpu_to_le32(layout->keyboard_map[i]);
a85e8e
diff --git a/util/mkimage.c b/util/mkimage.c
d41074
index 26d9816e07e..e6b799fd73c 100644
a85e8e
--- a/util/mkimage.c
a85e8e
+++ b/util/mkimage.c
a85e8e
@@ -1528,9 +1528,10 @@ grub_install_generate_image (const char *dir, const char *prefix,
a85e8e
 	text_section->virtual_address = grub_cpu_to_le32 (header_size);
a85e8e
 	text_section->raw_data_size = grub_cpu_to_le32 (exec_size);
a85e8e
 	text_section->raw_data_offset = grub_cpu_to_le32 (header_size);
a85e8e
-	text_section->characteristics = grub_cpu_to_le32 (GRUB_PE32_SCN_CNT_CODE
a85e8e
-							  | GRUB_PE32_SCN_MEM_EXECUTE
a85e8e
-							  | GRUB_PE32_SCN_MEM_READ);
a85e8e
+	text_section->characteristics = grub_cpu_to_le32_compile_time (
a85e8e
+						  GRUB_PE32_SCN_CNT_CODE
a85e8e
+						| GRUB_PE32_SCN_MEM_EXECUTE
a85e8e
+						| GRUB_PE32_SCN_MEM_READ);
a85e8e
 
a85e8e
 	data_section = text_section + 1;
a85e8e
 	strcpy (data_section->name, ".data");
a85e8e
@@ -1539,7 +1540,7 @@ grub_install_generate_image (const char *dir, const char *prefix,
a85e8e
 	data_section->raw_data_size = grub_cpu_to_le32 (kernel_size - exec_size);
a85e8e
 	data_section->raw_data_offset = grub_cpu_to_le32 (header_size + exec_size);
a85e8e
 	data_section->characteristics
a85e8e
-	  = grub_cpu_to_le32 (GRUB_PE32_SCN_CNT_INITIALIZED_DATA
a85e8e
+	  = grub_cpu_to_le32_compile_time (GRUB_PE32_SCN_CNT_INITIALIZED_DATA
a85e8e
 			      | GRUB_PE32_SCN_MEM_READ
a85e8e
 			      | GRUB_PE32_SCN_MEM_WRITE);
a85e8e
 
a85e8e
@@ -1551,7 +1552,7 @@ grub_install_generate_image (const char *dir, const char *prefix,
a85e8e
 	bss_section->raw_data_size = 0;
a85e8e
 	bss_section->raw_data_offset = 0;
a85e8e
 	bss_section->characteristics
a85e8e
-	  = grub_cpu_to_le32 (GRUB_PE32_SCN_MEM_READ
a85e8e
+	  = grub_cpu_to_le32_compile_time (GRUB_PE32_SCN_MEM_READ
a85e8e
 			      | GRUB_PE32_SCN_MEM_WRITE
a85e8e
 			      | GRUB_PE32_SCN_ALIGN_64BYTES
a85e8e
 			      | GRUB_PE32_SCN_CNT_INITIALIZED_DATA
a85e8e
@@ -1565,7 +1566,7 @@ grub_install_generate_image (const char *dir, const char *prefix,
a85e8e
 	mods_section->raw_data_size = grub_cpu_to_le32 (reloc_addr - kernel_size - header_size);
a85e8e
 	mods_section->raw_data_offset = grub_cpu_to_le32 (header_size + kernel_size);
a85e8e
 	mods_section->characteristics
a85e8e
-	  = grub_cpu_to_le32 (GRUB_PE32_SCN_CNT_INITIALIZED_DATA
a85e8e
+	  = grub_cpu_to_le32_compile_time (GRUB_PE32_SCN_CNT_INITIALIZED_DATA
a85e8e
 			      | GRUB_PE32_SCN_MEM_READ
a85e8e
 			      | GRUB_PE32_SCN_MEM_WRITE);
a85e8e
 
a85e8e
@@ -1576,7 +1577,7 @@ grub_install_generate_image (const char *dir, const char *prefix,
a85e8e
 	reloc_section->raw_data_size = grub_cpu_to_le32 (reloc_size);
a85e8e
 	reloc_section->raw_data_offset = grub_cpu_to_le32 (reloc_addr);
a85e8e
 	reloc_section->characteristics
a85e8e
-	  = grub_cpu_to_le32 (GRUB_PE32_SCN_CNT_INITIALIZED_DATA
a85e8e
+	  = grub_cpu_to_le32_compile_time (GRUB_PE32_SCN_CNT_INITIALIZED_DATA
a85e8e
 			      | GRUB_PE32_SCN_MEM_DISCARDABLE
a85e8e
 			      | GRUB_PE32_SCN_MEM_READ);
a85e8e
 	free (core_img);