1// Make sure BOLT correctly processes --hugify option
2
3#include <stdio.h>
4
5int main(int argc, char **argv) {
6 printf(format: "Hello world\n");
7 return 0;
8}
9
10/*
11REQUIRES: system-linux,bolt-runtime
12
13RUN: %clang %cflags -no-pie %s -o %t.nopie.exe -Wl,-q
14RUN: %clang %cflags -fpic %s -o %t.pie.exe -Wl,-q
15
16RUN: llvm-bolt %t.nopie.exe --lite=0 -o %t.nopie --hugify
17RUN: llvm-bolt %t.pie.exe --lite=0 -o %t.pie --hugify
18
19RUN: llvm-nm --numeric-sort --print-armap %t.nopie | \
20RUN: FileCheck %s -check-prefix=CHECK-NM
21RUN: %t.nopie | FileCheck %s -check-prefix=CHECK-NOPIE
22
23RUN: llvm-nm --numeric-sort --print-armap %t.pie | \
24RUN: FileCheck %s -check-prefix=CHECK-NM
25RUN: %t.pie | FileCheck %s -check-prefix=CHECK-PIE
26
27CHECK-NM: W __hot_start
28CHECK-NM-NEXT: T _start
29CHECK-NM: T main
30CHECK-NM: W __hot_end
31CHECK-NM: t __bolt_hugify_start_program
32CHECK-NM-NEXT: W __bolt_runtime_start
33
34CHECK-NOPIE: Hello world
35
36CHECK-PIE: Hello world
37
38*/
39

source code of bolt/test/runtime/hugify.c