-
-
Notifications
You must be signed in to change notification settings - Fork 482
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reflect the result of code-shrinking relaxation to symbol sizes
- Loading branch information
Showing
3 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
. $(dirname $0)/common.inc | ||
|
||
cat <<EOF | $CC -o $t/a.o -c -xassembler - | ||
.globl get_foo | ||
.type get_foo @function | ||
get_foo: | ||
lui a0, %hi(foo) | ||
add a0, a0, %lo(foo) | ||
ret | ||
.size get_foo, .-get_foo | ||
EOF | ||
|
||
cat <<EOF | $CC -o $t/b.o -c -xassembler - | ||
.globl foo, bar, baz | ||
foo = 0xf00 | ||
EOF | ||
|
||
cat <<EOF | $CC -o $t/c.o -c -xc - | ||
#include <stdio.h> | ||
int get_foo(); | ||
int main() { printf("%x\n", get_foo()); } | ||
EOF | ||
|
||
$CC -B. -o $t/exe $t/a.o $t/b.o $t/c.o | ||
|
||
readelf --syms $t/a.o | grep -Eq ' 10 FUNC .* get_foo$' | ||
readelf --syms $t/exe | grep -Eq ' 8 FUNC .* get_foo$' |