Skip to content

Enable goto-cc to build and link Xen #1357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

tautschnig
Copy link
Collaborator

No description provided.

@tautschnig
Copy link
Collaborator Author

Marking do-not-merge as it is an unhealthy mix of different bugfixes. Yet it makes a Xen build succeed when using the following script:

#!/usr/bin/env bash
# this should reproduce the compilation problem with goto-gcc on upstream Xen

set -e

# tested on Ubuntu 14.04
sudo apt-get install bcc python-dev uuid-dev libaio-dev libyajl-dev

# get upstream xen, move to staging branch
if [ ! -d xen.git ]
then
  git clone git://xenbits.xen.org/xen.git xen.git
fi
cd xen.git
git checkout staging

# the following patch is required to work around embedded-C problems
#--- a/xen/Makefile
#+++ b/xen/Makefile
#@@ -189,7 +189,7 @@ include/asm-$(TARGET_ARCH)/asm-offsets.h: arch/$(TARGET_ARCH)/asm-offsets.s
#          echo "#ifndef __ASM_OFFSETS_H__"; \
#          echo "#define __ASM_OFFSETS_H__"; \
#          echo ""; \
#-         sed -rne "/==>/{s:.*==>(.*)<==.*:\1:; s: [\$$#]: :; p;}"; \
#+         sed -rne "/^[^#].*==>/{s:.*==>(.*)<==.*:\1:; s: [\$$#]: :; p;}"; \
#          echo ""; \
#          echo "#endif") <$< >$@
#

# install goto-gcc as gcc replacement
mkdir -p hooks
pushd hooks
echo "goto-gcc --native-compiler /usr/bin/gcc \"\$@\"" > gcc
echo "goto-bcc --native-compiler /usr/bin/bcc \"\$@\"" > bcc
echo "goto-g++ --native-compiler /usr/bin/g++ \"\$@\"" > g++
echo "goto-as86 --native-assembler /usr/bin/as86 \"\$@\"" > as86
chmod u+x *
export PATH=$(pwd):$PATH
popd

export PATH=$HOME/cbmc-github.git/src/goto-cc:$HOME/cbmc-github.git/scripts:$PATH

# (re)build xen with goto-gcc as gcc replacement
./configure LD=goto-ld
make xen -j 1 LD=goto-ld

@tautschnig tautschnig self-assigned this Nov 30, 2017
@tautschnig tautschnig force-pushed the fix-goto-gcc-ls branch 2 times, most recently from 795ecc9 to d6079a9 Compare February 27, 2018 14:34
Running objcopy on EFI binaries does not work, hence we need to give up on the
goto-cc sections in a graceful manner.
As long as the bit-width of parameters matches, we should be able to obtain sane
results.
@tautschnig tautschnig changed the title Fix goto-gcc interaction around linker scripts Enable goto-cc to build and link Xen Apr 22, 2018
@tautschnig
Copy link
Collaborator Author

Rebased against latest develop to reduce the patch set to those that are specific to Xen (and thus retitled). Keeping do-not-merge as the linker hack is dubious and a full set-up for an integration test should be included (and that test should be performed) -- that test should just use the script posted above.

@tautschnig
Copy link
Collaborator Author

Closing as #2557 contains all the necessary fixes.

@tautschnig tautschnig closed this Jan 29, 2021
@tautschnig tautschnig deleted the fix-goto-gcc-ls branch January 29, 2021 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant