python-dataproperty: bump version to 0.17.0
[buildroot-gz.git] / package / elftosb / 0002-force-cxx-compiler.patch
blob14df0dbe463fa84c7c933365e949b9645f2c4a7e
1 Subject: [PATCH 1/1] elftosb: force host C++ compiler
3 Because Freescale provides *.cpp sources and elftosb links again libstdc++,
4 force to use the host c++ compiler.
6 This patch avoids the following error occurs:
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
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++.
22 Because elftosb is written in C++, this patch implement the sencond option, using
23 g++ and linking against libstdc++.
25 Signed-off-by: Samuel Martin <s.martin49@gmail.com>
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)
36 +CXX ?= g++
38 #*******************************************************************************
39 # Directories
41 @@ -37,9 +39,9 @@
42 #*******************************************************************************
43 # Build flags
44 -# gcc Compiler flags
45 +# Compiler flags
46 # -g : Produce debugging information.
48 -CFLAGS = -g $(INC_PATH) -D${UNAMES}
49 +CXXFLAGS = -g $(INC_PATH) -D${UNAMES}
51 #*******************************************************************************
52 # File lists
53 @@ -137,13 +139,13 @@ clean:
54 ${EXEC_FILE_ELFTOSB2} ${EXEC_FILE_SBTOOL} ${EXEC_FILE_KEYGEN}
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}
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}
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}
69 #ifeq ("${UNAMES}", "Linux")
70 @@ -153,10 +155,10 @@ keygen: ${OBJ_FILES_KEYGEN}
71 .SUFFIXES : .c .cpp
73 .c.o :
74 - gcc ${CFLAGS} -c $<
75 + $(CC) ${CXXFLAGS} -c $<
77 .cpp.o :
78 - gcc ${CFLAGS} -c $<
79 + $(CXX) ${CXXFLAGS} -c $<
81 #endif
83 @@ -165,13 +167,13 @@ keygen: ${OBJ_FILES_KEYGEN}
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 $@
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 $@