[PATCH] Solve more "-finstrument-functions" problems

297 views
Skip to first unread message

Nadav Har'El

unread,
Nov 4, 2014, 11:15:45 AM11/4/14
to osv...@googlegroups.com, Nadav Har'El
Solve more "-finstrument-functions" problems (see issue #530).

Our build.mk compiles the independent decompressing executable with
the regular CXXFLAGS, including "-finstrument-functions" if it includes
that - which won't work without the instrumentation functions.

So add "-fno-instrument-functions" when compiling the decompresser.

Signed-off-by: Nadav Har'El <n...@cloudius-systems.com>
---
build.mk | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/build.mk b/build.mk
index a8c8fdd..0cec635 100644
--- a/build.mk
+++ b/build.mk
@@ -435,18 +435,18 @@ arch/x64/boot32.o: loader.elf

fastlz/fastlz.o:
$(makedir)
- $(call quiet, $(CXX) $(CXXFLAGS) -O2 -m32 -o $@ -c $(src)/fastlz/fastlz.cc, CXX $@)
+ $(call quiet, $(CXX) $(CXXFLAGS) -O2 -m32 -fno-instrument-functions -o $@ -c $(src)/fastlz/fastlz.cc, CXX $@)

fastlz/lz: fastlz/fastlz.cc fastlz/lz.cc
$(makedir)
- $(call quiet, $(CXX) $(CXXFLASG) -O2 -o $@ $(filter %.cc, $^), CXX $@)
+ $(call quiet, $(CXX) $(CXXFLAGS) -O2 -o $@ $(filter %.cc, $^), CXX $@)

loader-stripped.elf.lz.o: loader-stripped.elf fastlz/lz
$(call quiet, fastlz/lz loader-stripped.elf, LZ $@)
$(call quiet, objcopy -B i386 -I binary -O elf32-i386 loader-stripped.elf.lz $@, OBJCOPY $@)

fastlz/lzloader.o: fastlz/lzloader.cc
- $(call quiet, $(CXX) $(CXXFLAGS) -O2 -m32 -o $@ -c $(src)/fastlz/lzloader.cc, CXX $@)
+ $(call quiet, $(CXX) $(CXXFLAGS) -O2 -m32 -fno-instrument-functions -o $@ -c $(src)/fastlz/lzloader.cc, CXX $@)

lzloader.elf: loader-stripped.elf.lz.o fastlz/lzloader.o arch/x64/lzloader.ld \
fastlz/fastlz.o
--
1.9.3

Commit Bot

unread,
Nov 4, 2014, 11:25:01 AM11/4/14
to osv...@googlegroups.com
From: Nadav Har'El <n...@cloudius-systems.com>

Solve more "-finstrument-functions" problems

Solve more "-finstrument-functions" problems (see issue #530).

Our build.mk compiles the independent decompressing executable with
the regular CXXFLAGS, including "-finstrument-functions" if it includes
that - which won't work without the instrumentation functions.

So add "-fno-instrument-functions" when compiling the decompresser.

Signed-off-by: Nadav Har'El <n...@cloudius-systems.com>
Signed-off-by: Avi Kivity <a...@cloudius-systems.com>

---
diff --git a/build.mk b/build.mk

Asias He

unread,
Nov 4, 2014, 9:08:55 PM11/4/14
to Nadav Har'El, Osv Dev
This fixes the issue when compiling lua module using gcc 4.9  (gcc version 4.9.1 20141024 (Red Hat 4.9.1-13)).  Thanks.

loadlib.c:(.text+0xf1c): undefined reference to `lua_pushcclosure'
loadlib.c:(.text+0xf30): undefined reference to `lua_rawseti'
loadlib.c:(.text+0xf46): undefined reference to `lua_pushvalue'
loadlib.c:(.text+0xf5a): undefined reference to `lua_setfield'
loadlib.c:(.text+0xf6e): undefined reference to `lua_setfield'
loadlib.c:(.text+0xfca): undefined reference to `lua_pushlstring'
loadlib.c:(.text+0xfde): undefined reference to `lua_setfield'
loadlib.c:(.text+0x1006): undefined reference to `lua_setfield'
loadlib.c:(.text+0x102e): undefined reference to `lua_setfield'
loadlib.c:(.text+0x1040): undefined reference to `lua_rawgeti'
loadlib.c:(.text+0x104d): undefined reference to `lua_pushvalue'
loadlib.c:(.text+0x106e): undefined reference to `lua_settop'
liblua.a(loadlib.o): In function `setpath':
loadlib.c:(.text+0xa8d): undefined reference to `lua_setfield'
collect2: error: ld returned 1 exit status
make[1]: *** [lua] Error 1
make[1]: Leaving directory `/home/asias/src/cloudius-systems/osv/modules/lua/src'
make: *** [src/liblua.so] Error 2



--
You received this message because you are subscribed to the Google Groups "OSv Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Asias

Pekka Enberg

unread,
Nov 5, 2014, 6:17:19 AM11/5/14
to Asias He, Nadav Har'El, Osv Dev
On Wed, Nov 5, 2014 at 4:08 AM, Asias He <as...@cloudius-systems.com> wrote:
> This fixes the issue when compiling lua module using gcc 4.9 (gcc version
> 4.9.1 20141024 (Red Hat 4.9.1-13)). Thanks.

Unfortunately this breaks build with GCC 4.8...

CXX arch/x64/smp.o
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/include/x86intrin.h:27:0,
from
/usr/include/c++/4.8.3/x86_64-redhat-linux/bits/opt_random.h:33,
from /usr/include/c++/4.8.3/random:51,
from /usr/include/c++/4.8.3/bits/stl_algo.h:65,
from /usr/include/c++/4.8.3/algorithm:62,
from /home/penberg/osv/arch/x64/memcpy_decode.hh:4,
from /home/penberg/osv/arch/x64/string.cc:20:
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/include/ia32intrin.h:31:1:
error: can’t set ‘no_instrument_function’ attribute after definition
__bsfd (int __X)
^
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/include/ia32intrin.h:39:1:
error: can’t set ‘no_instrument_function’ attribute after definition
__bsrd (int __X)
^
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/include/ia32intrin.h:47:1:
error: can’t set ‘no_instrument_function’ attribute after definition
__bswapd (int __X)
^
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/include/ia32intrin.h:79:1:
error: can’t set ‘no_instrument_function’ attribute after definition
__popcntd (unsigned int __X)
^
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/include/ia32intrin.h:87:1:
error: can’t set ‘no_instrument_function’ attribute after definition
__rdpmc (int __S)
^
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/include/ia32intrin.h:95:1:
error: can’t set ‘no_instrument_function’ attribute after definition
__rdtsc (void)
^
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/include/ia32intrin.h:103:1:
error: can’t set ‘no_instrument_function’ attribute after definition
__rdtscp (unsigned int *__A)
^
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/include/ia32intrin.h:111:1:
error: can’t set ‘no_instrument_function’ attribute after definition
__rolb (unsigned char __X, int __C)
^
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/include/ia32intrin.h:119:1:
error: can’t set ‘no_instrument_function’ attribute after definition
__rolw (unsigned short __X, int __C)
^
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/include/ia32intrin.h:127:1:
error: can’t set ‘no_instrument_function’ attribute after definition
__rold (unsigned int __X, int __C)
^

- Pekka

Avi Kivity

unread,
Nov 5, 2014, 6:29:38 AM11/5/14
to Pekka Enberg, Asias He, Nadav Har'El, Osv Dev
I guess we can detect whether the compiler will break in this way, and
apply the definition only if it doesn't, using the compiler-flag macro.


Nadav Har'El

unread,
Nov 5, 2014, 6:44:13 AM11/5/14
to Pekka Enberg, Asias He, Osv Dev
On Wed, Nov 5, 2014 at 1:17 PM, Pekka Enberg <pen...@cloudius-systems.com> wrote:
On Wed, Nov 5, 2014 at 4:08 AM, Asias He <as...@cloudius-systems.com> wrote:
> This fixes the issue when compiling lua module using gcc 4.9  (gcc version
> 4.9.1 20141024 (Red Hat 4.9.1-13)).  Thanks.

Unfortunately this breaks build with GCC 4.8...

I'll try a different solution for this problem.

hw.cl...@gmail.com

unread,
Nov 5, 2014, 10:09:47 AM11/5/14
to osv...@googlegroups.com, pen...@cloudius-systems.com, as...@cloudius-systems.com
Yes, I am stuck on this as well while trying to rebase the latest PCI work to master.

Currently I just removed all mention of instrument function everywhere (attributes, compiler flags and define hacks) and works again for me.

Reply all
Reply to author
Forward
0 new messages