kernel_loader: regenerate ELF bindings

BUG=b:218388029
TEST=tools/presubmit --quick

Change-Id: I6625b52691fc570e56005d4f59aeeea8d53e5eea
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3339808
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
Daniel Verkamp 2021-12-07 16:21:45 -08:00 committed by Commit Bot
parent fde6c3bb39
commit f2df14802c
3 changed files with 50 additions and 19 deletions

21
kernel_loader/bindgen.sh Executable file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env bash
# Copyright 2022 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Regenerate kernel_loader bindgen bindings.
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/.."
source tools/impl/bindgen-common.sh
bindgen_generate \
--allowlist-type='Elf64_Ehdr' \
--allowlist-type='Elf64_Phdr' \
--allowlist-var='.+' \
"${BINDGEN_LINUX_X86_HEADERS}/include/linux/elf.h" \
-- \
-isystem "${BINDGEN_LINUX_X86_HEADERS}/include" \
| replace_linux_int_types \
> kernel_loader/src/elf.rs

View file

@ -1,15 +1,9 @@
// Copyright 2019 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/* automatically generated by tools/bindgen-all-the-things */
/*
* automatically generated by bindgen
* From chromeos-linux v4.19 include/uapi/linux/elf.h
* $ bindgen \
* --no-layout-tests --with-derive-default \
* --allowlist-type Elf64_Ehdr --allowlist-type Elf64_Phdr --allowlist-var .+ \
* include/uapi/linux/elf.h
*/
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(dead_code)]
pub const __BITS_PER_LONG: u32 = 64;
pub const __FD_SETSIZE: u32 = 1024;
@ -40,14 +34,22 @@ pub const EM_CRIS: u32 = 76;
pub const EM_M32R: u32 = 88;
pub const EM_MN10300: u32 = 89;
pub const EM_OPENRISC: u32 = 92;
pub const EM_ARCOMPACT: u32 = 93;
pub const EM_XTENSA: u32 = 94;
pub const EM_BLACKFIN: u32 = 106;
pub const EM_UNICORE: u32 = 110;
pub const EM_ALTERA_NIOS2: u32 = 113;
pub const EM_TI_C6000: u32 = 140;
pub const EM_HEXAGON: u32 = 164;
pub const EM_NDS32: u32 = 167;
pub const EM_AARCH64: u32 = 183;
pub const EM_TILEPRO: u32 = 188;
pub const EM_MICROBLAZE: u32 = 189;
pub const EM_TILEGX: u32 = 191;
pub const EM_ARCV2: u32 = 195;
pub const EM_RISCV: u32 = 243;
pub const EM_BPF: u32 = 247;
pub const EM_CSKY: u32 = 252;
pub const EM_FRV: u32 = 21569;
pub const EM_ALPHA: u32 = 36902;
pub const EM_CYGNUS_M32R: u32 = 36929;
@ -66,6 +68,7 @@ pub const PT_HIOS: u32 = 1879048191;
pub const PT_LOPROC: u32 = 1879048192;
pub const PT_HIPROC: u32 = 2147483647;
pub const PT_GNU_EH_FRAME: u32 = 1685382480;
pub const PT_GNU_PROPERTY: u32 = 1685382483;
pub const PT_GNU_STACK: u32 = 1685382481;
pub const PN_XNUM: u32 = 65535;
pub const ET_NONE: u32 = 0;
@ -239,18 +242,24 @@ pub const NT_ARM_HW_BREAK: u32 = 1026;
pub const NT_ARM_HW_WATCH: u32 = 1027;
pub const NT_ARM_SYSTEM_CALL: u32 = 1028;
pub const NT_ARM_SVE: u32 = 1029;
pub const NT_ARM_PAC_MASK: u32 = 1030;
pub const NT_ARM_PACA_KEYS: u32 = 1031;
pub const NT_ARM_PACG_KEYS: u32 = 1032;
pub const NT_ARM_TAGGED_ADDR_CTRL: u32 = 1033;
pub const NT_ARM_PAC_ENABLED_KEYS: u32 = 1034;
pub const NT_ARC_V2: u32 = 1536;
pub const NT_VMCOREDD: u32 = 1792;
pub const NT_MIPS_DSP: u32 = 2048;
pub const NT_MIPS_FP_MODE: u32 = 2049;
pub type __u16 = ::std::os::raw::c_ushort;
pub type __u32 = ::std::os::raw::c_uint;
pub type __u64 = ::std::os::raw::c_ulonglong;
pub type Elf64_Addr = __u64;
pub type Elf64_Half = __u16;
pub type Elf64_Off = __u64;
pub type Elf64_Word = __u32;
pub type Elf64_Xword = __u64;
pub const NT_MIPS_MSA: u32 = 2050;
pub const NT_GNU_PROPERTY_TYPE_0: u32 = 5;
pub const GNU_PROPERTY_AARCH64_FEATURE_1_AND: u32 = 3221225472;
pub const GNU_PROPERTY_AARCH64_FEATURE_1_BTI: u32 = 1;
pub type Elf64_Addr = u64;
pub type Elf64_Half = u16;
pub type Elf64_Off = u64;
pub type Elf64_Word = u32;
pub type Elf64_Xword = u64;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct elf64_hdr {

View file

@ -21,6 +21,7 @@ die() {
dirs=(
common/io_uring
devices/src/virtio/gpu
kernel_loader
)
for d in "${dirs[@]}"; do