[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 0/2] hvmloader: drop usage of system headers


  • To: Roger Pau Monne <roger.pau@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Wed, 24 Feb 2021 20:08:25 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Jpy5KTCJ9VntIKIhkGd/IlAG+YImCBxAoiDRp24skIo=; b=Q2uIbybWtJUYUZZEvMaLnfLIujddsWeLABfC+B+J4CliCUfOff7IA33XNVxkBen4LfLgBTXxvUlRIM/Dvu9SVCs+0Fr2DxbjNQm+q4MwrdNvTGjmcLtUoRSYSKvZiovc1W2gQNdL6HqyE3KRGHxgPnVJ7Z2ovNh58I/nc4Pr76G7BADu60rzGpUFf2LsrZGPRNBhnckB6N1Nw9yHNpxBZWYJtM2BOgb0XnQM4iFfSHWzkGVVF8gQ5ozmbnPQ01bpfqSHqTx04qX101v8wmgDAaxGPPT1i1VLeVVQ45qxBarT/VZk/OiFoe4UF8fT8PGqC6/bEZQWLy7o5KQ4JB2BMQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EUooNNbCyrCIgydRzrZTAOwSyPNbcE8D3lKnQLVo7rF/3XTmZMPIYWivjKvbkpm3LjzafS37K8A1Snx2nO1KMIx2OwUR/65LL84AKzFW4D1gcdJbdVR9MJ8Fw19WuAiz9nHDrcTv7zGrsgaDmDZRjVqY+DatAvuL+4bK9R8H7WC+LNXKVcTeZp+lQoPxrzZ01Sne04F8XFhWLDGXZAWTSJ3V0b8Uh5XM8g86ckF2Rgpn7n2VI6jAbYxCaSu7hi/27xMkOPGbwvM4WDT7YiRiAmrlaWpalRLdgQU2zw0iE97T88CJs0wZneLMsLN5SLyCplqxhw4Qq9p8+7lu9U6kbQ==
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Jan Beulich <jbeulich@xxxxxxxx>, Wei Liu <wl@xxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>
  • Delivery-date: Wed, 24 Feb 2021 20:08:47 +0000
  • Ironport-sdr: NPchT8xj3OMVHVeKeApWdGJ0o8BqTClSsOv77AQYZcnVoyj0kBUupOimxjxJEaWzAt2F0cS+xH K/n8E7ZPhu1dncLaPwbRwWVKAlpW3zbERyterWjTKldIphjnBWVRgYq1/338meutFvHv+v2SRK 7B44IkVavgaxooxV9KMlK53s2mtc7J/prdrXBqL4236kz3BVaV7cc69qkqiRC90/CG1gin5Dx1 fWsxFJIv+i/9omguRnU1cG6NVHRkO7y47JumLc/pqhdX4ChsLytGSZ5Wd6z13JuPweVj3ydvQU rgM=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 24/02/2021 10:26, Roger Pau Monne wrote:
> Hello,
>
> Following two patches aim to make hvmloader standalone, so that it don't
> try to use system headers. It shouldn't result in any functional
> change.
>
> Thanks, Roger.

After some experimentation in the arch container

Given foo.c as:

#include <stdint.h>

extern uint64_t bar;
uint64_t foo(void)
{
    return bar;
}

int main(void)
{
    return 0;
}

The preprocessed form with `gcc -m32 -E` is:

# 1 "foo.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<command-line>" 2
# 1 "foo.c"
# 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/stdint.h" 1 3 4
# 9 "/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/stdint.h" 3 4
# 1 "/usr/include/stdint.h" 1 3 4
# 26 "/usr/include/stdint.h" 3 4
# 1 "/usr/include/bits/libc-header-start.h" 1 3 4
# 33 "/usr/include/bits/libc-header-start.h" 3 4
# 1 "/usr/include/features.h" 1 3 4
# 450 "/usr/include/features.h" 3 4
# 1 "/usr/include/sys/cdefs.h" 1 3 4
# 452 "/usr/include/sys/cdefs.h" 3 4
# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 453 "/usr/include/sys/cdefs.h" 2 3 4
# 1 "/usr/include/bits/long-double.h" 1 3 4
# 454 "/usr/include/sys/cdefs.h" 2 3 4
# 451 "/usr/include/features.h" 2 3 4
# 474 "/usr/include/features.h" 3 4
# 1 "/usr/include/gnu/stubs.h" 1 3 4

# 1 "/usr/include/gnu/stubs-32.h" 1 3 4
# 8 "/usr/include/gnu/stubs.h" 2 3 4
# 475 "/usr/include/features.h" 2 3 4
# 34 "/usr/include/bits/libc-header-start.h" 2 3 4
# 27 "/usr/include/stdint.h" 2 3 4
# 1 "/usr/include/bits/types.h" 1 3 4
# 27 "/usr/include/bits/types.h" 3 4
# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 28 "/usr/include/bits/types.h" 2 3 4
# 1 "/usr/include/bits/timesize.h" 1 3 4
# 29 "/usr/include/bits/types.h" 2 3 4

# 31 "/usr/include/bits/types.h" 3 4
typedef unsigned char __u_char;
...

while the freestanding form with `gcc -ffreestanding -m32 -E` is:

# 1 "foo.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "foo.c"
# 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/stdint.h" 1 3 4
# 11 "/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/stdint.h" 3 4
# 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/stdint-gcc.h" 1 3 4
# 34 "/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/stdint-gcc.h" 3 4

# 34 "/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/stdint-gcc.h" 3 4
typedef signed char int8_t;
...


I can compile and link trivial programs using -m32 and stdint.h without
any issue.

Clearly something more subtle is going on with our choice of options
when compiling hvmloader, but it certainly looks like stdint.h is fine
to use in the way we want to use it.

~Andrew



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.