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

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