[Commotion-dev] Can't talk between desktop OLSRd and Commotion OpenWRT boxes

Mikael Nordfeldth mmn at hethane.se
Sat Mar 9 18:34:43 UTC 2013


2013-03-08 19:27, Hans-Christoph Steiner skrev:
> That would be quite useful if you have the time!  Another thing that might the
> whole process easier is to 'git bisect', if you are familiar with that..
> Right now, Debian squeeze and wheezy have 0.6.2, and Ubuntu has 0.6.1 and 0.6.3:
> 
> http://packages.debian.org/search?keywords=olsrd
> http://packages.ubuntu.com/search?keywords=olsrd
> 
> So the idea is to find out which version of these we can rely on, and which we
> need to use replacements.

Gah. This seems way more advanced than what I can explain with my
knowledge. Nevertheless, I did find what caused my error, the -O2 gcc
optimization switch as patched by Debian package "hardening fixes":

1. I tried compiling various olsrd versions. All worked.
2. I tried compiling 0.6.3-5~quantal from 'apt-get source'. It didn't work.
3. I tried compiling the 0.6.3.orig source (same as above, without
debian patches) It worked.
4. None of the patches contained any networking code (except the json
plugin, but disabling it didn't have any effect anyway)
5. I found that removing the -O2 switch on line 227 in Makefile.inc, as
patched by 310-hardening-fixes.patch resolved my invalid argument
sendto(v4) issue:

 %.o: %.c
        @echo "[CC] $<"
-       $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
+       $(CC) -O2 $(CFLAGS) $(CPPFLAGS) -fPIE -c -o $@ $<


Reverting this (and even leaving the -fPIE there but removing -O2) makes
the resulting binary functional.


So the specific problem was caused by the -O2 parameter to gcc, I guess
making it a compiling/linking issue. I don't know enough about this
myself though, so I'm attaching ('O2-opts') the output of what that
level of optimizations means if anyone is interested (gcc -c -Q -O2
--help=optimizers)

More info on my build environment is below:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.7.2-2ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.7 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--enable-gnu-unique-object --enable-plugin --enable-objc-gc
--disable-werror --with-arch-32=i686 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-2ubuntu1)


$ uname -a
Linux plexi 3.5.0-25-generic #39-Ubuntu SMP Mon Feb 25 18:26:58 UTC 2013
x86_64 x86_64 x86_64 GNU/Linux
-------------- next part --------------
The following options control optimizations:
  -O<number>                  		
  -Ofast                      		
  -Os                         		
  -falign-functions           		[enabled]
  -falign-jumps               		[enabled]
  -falign-labels              		[enabled]
  -falign-loops               		[enabled]
  -fasynchronous-unwind-tables 		[enabled]
  -fbranch-count-reg          		[enabled]
  -fbranch-probabilities      		[disabled]
  -fbranch-target-load-optimize 	[disabled]
  -fbranch-target-load-optimize2 	[disabled]
  -fbtr-bb-exclusive          		[disabled]
  -fcaller-saves              		[enabled]
  -fcombine-stack-adjustments 		[enabled]
  -fcommon                    		[enabled]
  -fcompare-elim              		[enabled]
  -fconserve-stack            		[disabled]
  -fcprop-registers           		[enabled]
  -fcrossjumping              		[enabled]
  -fcse-follow-jumps          		[enabled]
  -fcx-fortran-rules          		[disabled]
  -fcx-limited-range          		[disabled]
  -fdata-sections             		[disabled]
  -fdce                       		[enabled]
  -fdefer-pop                 		[enabled]
  -fdelayed-branch            		[disabled]
  -fdelete-null-pointer-checks 		[enabled]
  -fdevirtualize              		[enabled]
  -fdse                       		[enabled]
  -fearly-inlining            		[enabled]
  -fexceptions                		[disabled]
  -fexpensive-optimizations   		[enabled]
  -ffinite-math-only          		[disabled]
  -ffloat-store               		[disabled]
  -fforward-propagate         		[enabled]
  -fgcse                      		[enabled]
  -fgcse-after-reload         		[disabled]
  -fgcse-las                  		[disabled]
  -fgcse-lm                   		[enabled]
  -fgcse-sm                   		[disabled]
  -fgraphite-identity         		[disabled]
  -fguess-branch-probability  		[enabled]
  -fhandle-exceptions         		
  -fif-conversion             		[enabled]
  -fif-conversion2            		[enabled]
  -finline-atomics            		[enabled]
  -finline-functions          		[disabled]
  -finline-functions-called-once 	[enabled]
  -finline-small-functions    		[enabled]
  -fipa-cp                    		[enabled]
  -fipa-cp-clone              		[disabled]
  -fipa-matrix-reorg          		[disabled]
  -fipa-profile               		[enabled]
  -fipa-pta                   		[disabled]
  -fipa-pure-const            		[enabled]
  -fipa-reference             		[enabled]
  -fipa-sra                   		[enabled]
  -fivopts                    		[enabled]
  -fjump-tables               		[enabled]
  -floop-block                		[disabled]
  -floop-flatten              		[disabled]
  -floop-interchange          		[disabled]
  -floop-parallelize-all      		[disabled]
  -floop-strip-mine           		[disabled]
  -fmath-errno                		[enabled]
  -fmerge-all-constants       		[disabled]
  -fmerge-constants           		[enabled]
  -fmodulo-sched              		[disabled]
  -fmove-loop-invariants      		[enabled]
  -fnon-call-exceptions       		[disabled]
  -fnothrow-opt               		[disabled]
  -fomit-frame-pointer        		[disabled]
  -foptimize-register-move    		[enabled]
  -foptimize-sibling-calls    		[enabled]
  -foptimize-strlen           		[enabled]
  -fpack-struct               		[disabled]
  -fpack-struct=<number>      		
  -fpeel-loops                		[disabled]
  -fpeephole                  		[enabled]
  -fpeephole2                 		[enabled]
  -fpredictive-commoning      		[disabled]
  -fprefetch-loop-arrays      		[enabled]
  -freg-struct-return         		[disabled]
  -fregmove                   		[enabled]
  -frename-registers          		[enabled]
  -freorder-blocks            		[enabled]
  -freorder-blocks-and-partition 	[disabled]
  -freorder-functions         		[enabled]
  -frerun-cse-after-loop      		[enabled]
  -freschedule-modulo-scheduled-loops 	[disabled]
  -frounding-math             		[disabled]
  -frtti                      		[enabled]
  -fsched-critical-path-heuristic 	[enabled]
  -fsched-dep-count-heuristic 		[enabled]
  -fsched-group-heuristic     		[enabled]
  -fsched-interblock          		[enabled]
  -fsched-last-insn-heuristic 		[enabled]
  -fsched-pressure            		[disabled]
  -fsched-rank-heuristic      		[enabled]
  -fsched-spec                		[enabled]
  -fsched-spec-insn-heuristic 		[enabled]
  -fsched-spec-load           		[disabled]
  -fsched-spec-load-dangerous 		[disabled]
  -fsched-stalled-insns       		[disabled]
  -fsched-stalled-insns-dep   		[enabled]
  -fsched2-use-superblocks    		[disabled]
  -fschedule-insns            		[disabled]
  -fschedule-insns2           		[enabled]
  -fsection-anchors           		[disabled]
  -fsel-sched-pipelining      		[disabled]
  -fsel-sched-pipelining-outer-loops 	[disabled]
  -fsel-sched-reschedule-pipelined 	[disabled]
  -fselective-scheduling      		[disabled]
  -fselective-scheduling2     		[disabled]
  -fshort-double              		[disabled]
  -fshort-enums               		[enabled]
  -fshort-wchar               		[disabled]
  -fshrink-wrap               		[enabled]
  -fsignaling-nans            		[disabled]
  -fsigned-zeros              		[enabled]
  -fsingle-precision-constant 		[disabled]
  -fsplit-ivs-in-unroller     		[enabled]
  -fsplit-wide-types          		[enabled]
  -fstrict-aliasing           		[enabled]
  -fstrict-enums              		[disabled]
  -fthread-jumps              		[enabled]
  -fno-threadsafe-statics     		[enabled]
  -ftoplevel-reorder          		[enabled]
  -ftrapping-math             		[enabled]
  -ftrapv                     		[disabled]
  -ftree-bit-ccp              		[enabled]
  -ftree-builtin-call-dce     		[enabled]
  -ftree-ccp                  		[enabled]
  -ftree-ch                   		[enabled]
  -ftree-copy-prop            		[enabled]
  -ftree-copyrename           		[enabled]
  -ftree-cselim               		[enabled]
  -ftree-dce                  		[enabled]
  -ftree-dominator-opts       		[enabled]
  -ftree-dse                  		[enabled]
  -ftree-forwprop             		[enabled]
  -ftree-fre                  		[enabled]
  -ftree-loop-distribute-patterns 	[disabled]
  -ftree-loop-distribution    		[disabled]
  -ftree-loop-if-convert      		[enabled]
  -ftree-loop-if-convert-stores 	[disabled]
  -ftree-loop-im              		[enabled]
  -ftree-loop-ivcanon         		[enabled]
  -ftree-loop-optimize        		[enabled]
  -ftree-lrs                  		[disabled]
  -ftree-partial-pre          		[disabled]
  -ftree-phiprop              		[enabled]
  -ftree-pre                  		[enabled]
  -ftree-pta                  		[enabled]
  -ftree-reassoc              		[enabled]
  -ftree-scev-cprop           		[enabled]
  -ftree-sink                 		[enabled]
  -ftree-slp-vectorize        		[enabled]
  -ftree-sra                  		[enabled]
  -ftree-switch-conversion    		[enabled]
  -ftree-tail-merge           		[enabled]
  -ftree-ter                  		[enabled]
  -ftree-vect-loop-version    		[enabled]
  -ftree-vectorize            		[disabled]
  -ftree-vrp                  		[enabled]
  -funit-at-a-time            		[enabled]
  -funroll-all-loops          		[disabled]
  -funroll-loops              		[disabled]
  -funsafe-loop-optimizations 		[disabled]
  -funsafe-math-optimizations 		[disabled]
  -funswitch-loops            		[disabled]
  -funwind-tables             		[disabled]
  -fvar-tracking              		[enabled]
  -fvar-tracking-assignments  		[enabled]
  -fvar-tracking-assignments-toggle 	[disabled]
  -fvar-tracking-uninit       		[disabled]
  -fvariable-expansion-in-unroller 	[disabled]
  -fvect-cost-model           		[enabled]
  -fvpt                       		[disabled]
  -fweb                       		[enabled]
  -fwhole-program             		[disabled]
  -fwrapv                     		[disabled]



More information about the Commotion-dev mailing list