The cirros image was rebuilt against the 3.13.0-83 kernel, drivers e1000e, igbvf...
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / elftosb / 0002-force-cxx-compiler.patch
1 Subject: [PATCH 1/1] elftosb: force host C++ compiler
2
3 Because Freescale provides *.cpp sources and elftosb links again libstdc++,
4 force to use the host c++ compiler.
5
6 This patch avoids the following error occurs:
7
8 gcc AESKey.o Blob.o crc.o DataSource.o DataTarget.o ELFSourceFile.o EncoreBootImage.o EvalContext.o GHSSecInfo.o GlobMatcher.o HexValues.o Logging.o Operation.o OptionDictionary.o options.o OutputSection.o Random.o RijndaelCBCMAC.o rijndael.o SHA1.o SourceFile.o SRecordSourceFile.o stdafx.o StELFFile.o StExecutableImage.o StSRecordFile.o Value.o Version.o format_string.o ExcludesListMatcher.o SearchPath.o DataSourceImager.o IVTDataSource.o BootImageGenerator.o ConversionController.o ElftosbAST.o elftosb.o elftosb_lexer.o ElftosbLexer.o elftosb_parser.tab.o EncoreBootImageGenerator.o -lstdc++ -o elftosb
9 /usr/bin/ld: ElftosbAST.o: undefined reference to symbol 'powf@@GLIBC_2.2.5'
10 /usr/bin/ld: note: 'powf@@GLIBC_2.2.5' is defined in DSO /lib64/libm.so.6 so try adding it to the linker command line
11 /lib64/libm.so.6: could not read symbols: Invalid operation
12 collect2: error: ld returned 1 exit status
13
14 When compiling with gcc and linking against libstdc++, ld uses libc instead of
15 libstdc++.
16 However, libc does not provide all functions libstdc++ does.
17 Indeed, maths functions are provided by libm, not libc.
18 Thus, elftosb should either:
19 - use gcc and link against libc and libm;
20 - or use g++ and link against libstdc++.
21
22 Because elftosb is written in C++, this patch implement the sencond option, using
23 g++ and linking against libstdc++.
24
25 Signed-off-by: Samuel Martin <s.martin49@gmail.com>
26
27 ---
28 Index: host-elftosb-10.12.01/makefile.rules
29 ===================================================================
30 --- host-elftosb-10.12.01.orig/makefile.rules   2012-06-09 21:12:23.557526100 +0200
31 +++ host-elftosb-10.12.01/makefile.rules        2012-06-09 21:15:21.659894571 +0200
32 @@ -15,6 +15,8 @@
33  # UNAMES is going to be set to either "Linux" or "CYGWIN_NT-5.1"
34  UNAMES = $(shell uname -s)
35
36 +CXX ?= g++
37 +
38  #*******************************************************************************
39  #                               Directories
40
41 @@ -37,9 +39,9 @@
42  #*******************************************************************************
43  #                               Build flags
44 -# gcc Compiler flags
45 +# Compiler flags
46  #    -g                                                : Produce debugging information.
47
48 -CFLAGS     = -g $(INC_PATH) -D${UNAMES}
49 +CXXFLAGS       = -g $(INC_PATH) -D${UNAMES}
50
51  #*******************************************************************************
52  #                               File lists
53 @@ -137,13 +139,13 @@ clean:
54                 ${EXEC_FILE_ELFTOSB2} ${EXEC_FILE_SBTOOL} ${EXEC_FILE_KEYGEN}
55
56  elftosb: ${OBJ_FILES_ELFTOSB2}
57 -       gcc ${OBJ_FILES_ELFTOSB2} ${LIBS} -o ${EXEC_FILE_ELFTOSB2}
58 +       $(CXX) ${OBJ_FILES_ELFTOSB2} ${LIBS} -o ${EXEC_FILE_ELFTOSB2}
59
60  sbtool: ${OBJ_FILES_SBTOOL}
61 -       gcc ${OBJ_FILES_SBTOOL} ${LIBS} -o ${EXEC_FILE_SBTOOL}
62 +       $(CXX) ${OBJ_FILES_SBTOOL} ${LIBS} -o ${EXEC_FILE_SBTOOL}
63
64  keygen: ${OBJ_FILES_KEYGEN}
65 -       gcc ${OBJ_FILES_KEYGEN} ${LIBS} -o ${EXEC_FILE_KEYGEN}
66 +       $(CXX) ${OBJ_FILES_KEYGEN} ${LIBS} -o ${EXEC_FILE_KEYGEN}
67
68
69  #ifeq ("${UNAMES}", "Linux")
70 @@ -153,10 +155,10 @@ keygen: ${OBJ_FILES_KEYGEN}
71  .SUFFIXES : .c .cpp
72
73  .c.o :
74 -       gcc ${CFLAGS} -c $<
75 +       $(CC) ${CXXFLAGS} -c $<
76
77  .cpp.o :
78 -       gcc ${CFLAGS} -c $<
79 +       $(CXX) ${CXXFLAGS} -c $<
80
81  #endif
82
83 @@ -165,13 +167,13 @@ keygen: ${OBJ_FILES_KEYGEN}
84
85  %.d: %.c
86         @set -e; \
87 -       $(CC) -MM $(CFLAGS) $< | \
88 +       $(CC) -MM $(CXXFLAGS) $< | \
89         sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
90         [ -s $@ ]  || rm -f $@
91
92  %.d: %.cpp
93         @set -e; \
94 -       $(CC) -MM $(CFLAGS) $< | \
95 +       $(CXX) -MM $(CXXFLAGS) $< | \
96         sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
97         [ -s $@ ]  || rm -f $@
98