aboutsummaryrefslogtreecommitdiff
path: root/src/commonlib
diff options
context:
space:
mode:
Diffstat (limited to 'src/commonlib')
-rw-r--r--src/commonlib/fsp_relocate.c1
-rw-r--r--src/commonlib/include/commonlib/cbfs_serialized.h1
-rw-r--r--src/commonlib/include/commonlib/compiler.h51
-rw-r--r--src/commonlib/include/commonlib/fmap_serialized.h1
-rw-r--r--src/commonlib/include/commonlib/rmodule-defs.h1
-rw-r--r--src/commonlib/include/commonlib/tcpa_log_serialized.h1
-rw-r--r--src/commonlib/include/commonlib/timestamp_serialized.h1
-rw-r--r--src/commonlib/lz4_wrapper.c1
-rw-r--r--src/commonlib/storage/sdhci.c1
9 files changed, 51 insertions, 8 deletions
diff --git a/src/commonlib/fsp_relocate.c b/src/commonlib/fsp_relocate.c
index d96edd2178..fe58a29d27 100644
--- a/src/commonlib/fsp_relocate.c
+++ b/src/commonlib/fsp_relocate.c
@@ -13,7 +13,6 @@
* GNU General Public License for more details.
*/
-#include <compiler.h>
#include <console/console.h>
#include <commonlib/endian.h>
#include <commonlib/fsp.h>
diff --git a/src/commonlib/include/commonlib/cbfs_serialized.h b/src/commonlib/include/commonlib/cbfs_serialized.h
index e8f027fad3..6e254f6bbe 100644
--- a/src/commonlib/include/commonlib/cbfs_serialized.h
+++ b/src/commonlib/include/commonlib/cbfs_serialized.h
@@ -48,7 +48,6 @@
#define _CBFS_SERIALIZED_H_
#include <stdint.h>
-#include <compiler.h>
/** These are standard values for the known compression
algorithms that coreboot knows about for stages and
diff --git a/src/commonlib/include/commonlib/compiler.h b/src/commonlib/include/commonlib/compiler.h
new file mode 100644
index 0000000000..2e0c454fc9
--- /dev/null
+++ b/src/commonlib/include/commonlib/compiler.h
@@ -0,0 +1,51 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2017 Google Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _COMMONLIB_COMPILER_H_
+#define _COMMONLIB_COMPILER_H_
+
+#ifndef __packed
+#if defined(__WIN32) || defined(__WIN64)
+#define __packed __attribute__((gcc_struct, packed))
+#else
+#define __packed __attribute__((packed))
+#endif
+#endif
+
+#ifndef __aligned
+#define __aligned(x) __attribute__((aligned(x)))
+#endif
+
+#ifndef __always_unused
+#define __always_unused __attribute__((unused))
+#endif
+
+#ifndef __must_check
+#define __must_check __attribute__((warn_unused_result))
+#endif
+
+#ifndef __weak
+#define __weak __attribute__((weak))
+#endif
+
+#ifndef __noreturn
+#define __noreturn __attribute__((noreturn))
+#endif
+
+#ifndef __always_inline
+#define __always_inline inline __attribute__((always_inline))
+#endif
+
+#endif
diff --git a/src/commonlib/include/commonlib/fmap_serialized.h b/src/commonlib/include/commonlib/fmap_serialized.h
index cea231b2c2..1e83760442 100644
--- a/src/commonlib/include/commonlib/fmap_serialized.h
+++ b/src/commonlib/include/commonlib/fmap_serialized.h
@@ -37,7 +37,6 @@
#define FLASHMAP_SERIALIZED_H__
#include <stdint.h>
-#include <compiler.h>
#define FMAP_SIGNATURE "__FMAP__"
#define FMAP_VER_MAJOR 1 /* this header's FMAP minor version */
diff --git a/src/commonlib/include/commonlib/rmodule-defs.h b/src/commonlib/include/commonlib/rmodule-defs.h
index 485d6383bf..564fcd26af 100644
--- a/src/commonlib/include/commonlib/rmodule-defs.h
+++ b/src/commonlib/include/commonlib/rmodule-defs.h
@@ -17,7 +17,6 @@
#include <stdint.h>
#include <stddef.h>
-#include <compiler.h>
#define RMODULE_MAGIC 0xf8fe
#define RMODULE_VERSION_1 1
diff --git a/src/commonlib/include/commonlib/tcpa_log_serialized.h b/src/commonlib/include/commonlib/tcpa_log_serialized.h
index 6dfb566fdc..1e9ffaab87 100644
--- a/src/commonlib/include/commonlib/tcpa_log_serialized.h
+++ b/src/commonlib/include/commonlib/tcpa_log_serialized.h
@@ -16,7 +16,6 @@
#ifndef __TCPA_LOG_SERIALIZED_H__
#define __TCPA_LOG_SERIALIZED_H__
-#include <compiler.h>
#include <stdint.h>
#define MAX_TCPA_LOG_ENTRIES 50
diff --git a/src/commonlib/include/commonlib/timestamp_serialized.h b/src/commonlib/include/commonlib/timestamp_serialized.h
index 304e43fab9..cbf07b5aac 100644
--- a/src/commonlib/include/commonlib/timestamp_serialized.h
+++ b/src/commonlib/include/commonlib/timestamp_serialized.h
@@ -17,7 +17,6 @@
#define __TIMESTAMP_SERIALIZED_H__
#include <stdint.h>
-#include <compiler.h>
struct timestamp_entry {
uint32_t entry_id;
diff --git a/src/commonlib/lz4_wrapper.c b/src/commonlib/lz4_wrapper.c
index 8f516089ca..474df642c2 100644
--- a/src/commonlib/lz4_wrapper.c
+++ b/src/commonlib/lz4_wrapper.c
@@ -34,7 +34,6 @@
#include <commonlib/helpers.h>
#include <stdint.h>
#include <string.h>
-#include <compiler.h>
/* LZ4 comes with its own supposedly portable memory access functions, but they
* seem to be very inefficient in practice (at least on ARM64). Since coreboot
diff --git a/src/commonlib/storage/sdhci.c b/src/commonlib/storage/sdhci.c
index 158e28b648..fd3915f92e 100644
--- a/src/commonlib/storage/sdhci.c
+++ b/src/commonlib/storage/sdhci.c
@@ -22,7 +22,6 @@
#include <commonlib/sd_mmc_ctrlr.h>
#include <commonlib/sdhci.h>
#include <commonlib/storage.h>
-#include <compiler.h>
#include <delay.h>
#include <endian.h>
#include <halt.h>