[U-Boot,v6,06/13] efi: sandbox: Add relocation constants

Message ID 20180613023728.202173-7-sjg@chromium.org
State New
Headers show
Series
  • efi: Enable basic sandbox support for EFI loader
Related show

Commit Message

Simon Glass June 13, 2018, 2:37 a.m.
Add these so that we can build the EFI loader for sandbox. The values are
for x86_64 so potentially bogus. But we don't support relocation within
sandbox anyway.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v6:
- Warn about building sandbox EFI support on something other than __x86_64__

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 lib/efi_loader/efi_runtime.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Alexander Graf June 14, 2018, 10:14 a.m. | #1
On 06/13/2018 04:37 AM, Simon Glass wrote:
> Add these so that we can build the EFI loader for sandbox. The values are
> for x86_64 so potentially bogus. But we don't support relocation within
> sandbox anyway.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v6:
> - Warn about building sandbox EFI support on something other than __x86_64__
>
> Changes in v5: None
> Changes in v4: None
> Changes in v3: None
> Changes in v2: None
>
>   lib/efi_loader/efi_runtime.c | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
>
> diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
> index 65f2bcf140..acda21c91d 100644
> --- a/lib/efi_loader/efi_runtime.c
> +++ b/lib/efi_loader/efi_runtime.c
> @@ -58,6 +58,18 @@ struct dyn_sym {
>   #define R_ABSOLUTE	R_RISCV_64
>   #define SYM_INDEX	32
>   #endif
> +
> +/* For sandbox we only support 64-bit x86 at present */

Same here. TODO with #ifndef is plenty to tell people what you're trying 
to say :)

Alex

> +#elif defined(CONFIG_SANDBOX)
> +/*
> + * TODO(sjg@chromium.org): Consider providing a way to enable sandbox features
> + * based on the host architecture
> + */
> +# ifndef __x86_64__
> +#  warning "sandbox EFI support is only tested on 64-bit x86"
> +# endif
> +#define R_RELATIVE	8
> +#define R_MASK		0xffffffffULL
>   #else
>   #error Need to add relocation awareness
>   #endif

Patch

diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
index 65f2bcf140..acda21c91d 100644
--- a/lib/efi_loader/efi_runtime.c
+++ b/lib/efi_loader/efi_runtime.c
@@ -58,6 +58,18 @@  struct dyn_sym {
 #define R_ABSOLUTE	R_RISCV_64
 #define SYM_INDEX	32
 #endif
+
+/* For sandbox we only support 64-bit x86 at present */
+#elif defined(CONFIG_SANDBOX)
+/*
+ * TODO(sjg@chromium.org): Consider providing a way to enable sandbox features
+ * based on the host architecture
+ */
+# ifndef __x86_64__
+#  warning "sandbox EFI support is only tested on 64-bit x86"
+# endif
+#define R_RELATIVE	8
+#define R_MASK		0xffffffffULL
 #else
 #error Need to add relocation awareness
 #endif