I was building a minimal image for my router (a TD-W8970 v1.2). Exploring with "make menuconfig" I ended up reading the "Target options" configuration page (under "Advanced configuration options (for developers)").
I have some question about the last two parameters
-mips32r2 -mtune=24kc
"-mips32r2" is just a shortcut for "-march=mips32r2"
Now I usually saw mtune and march used in this way, tell me if I'm wrong:
You have a set of devices that will run your compiled stuff
That set has various ISA
Choose march to be the "least common denominator" ISA between all the ISA that your device has
Optional: use mtune if you want to optimize your binaries for a specific device, keeping compatibility with the whole initial set
So... (if I'm not wrong)... since I'm building a highly custom build just for my TD-W8970 should I write:
-march=24kc -mtune=24kc
Of course:
Assuming "24kc" is more strict than "mips32r2" (IMO it will not makes sense the other way around)
This will probably make the "mtune" useless (if you build something that works only on 24kc ISA it should already be optimized for 24kc ISA. Am I right?)
EDIT: I should use only -march=34kc read next posts to know why
Optimize for arch. Among other things, this option controls the way instructions are scheduled, and the perceived cost of arithmetic operations. The list of arch values is the same as for -march.
When this option is not used, GCC optimizes for the processor specified by -march. By using -march and -mtune together, it is possible to generate code that runs on a family of processors, but optimize the code for one particular member of that family.
I read that too. That's why I made this thread. Why OpenWRT build system does not directly select the best march value (24kc in my case) after the target selection?
-march=24kc
should generate faster code than
-mips32r2 -mtune=24kc
EDIT: I should use 34kc (instead of 24kc) see next post to know why.
Quick update. I've compiled a minimal version of last LEDE sources with "-march=34kc" and it seem to work perfectly. Did the same on 18.06, everything works but I didn't test it enough. Left trunk alonse since is unstable by itself right now.