Respect linking order of libraries by maxgerhardt · Pull Request #8263 · esp8266/Arduino (original) (raw)
Fixes #8262.
Arduino IDE link order:
-lhal -lphy -lpp -lnet80211 -llwip2-536-feat -lwpa -lcrypto -lmain -lwps -lbearssl -lespnow -lsmartconfig -lairkiss -lwpa2 -lstdc++ -lm -lc -lgcc
PlatformIO link order before this fix:
-lhal -lphy -lpp -lnet80211 -lwpa -lcrypto -lmain -lwps -lbearssl -lespnow -lsmartconfig -lairkiss -lwpa2 -lm -lc -lgcc -llwip2-536-feat -lstdc++
(^ which causes the linking failure in regards to the math library in the referenced issue)
PlatformIO link order after this fix:
-lhal -lphy -lpp -lnet80211 -llwip2-536-feat -lwpa -lcrypto -lmain -lwps -lbearssl -lespnow -lsmartconfig -lairkiss -lwpa2 -lstdc++ -lm -lc -lgcc
Aka, now equivalent to the Arduino IDE linking order.
The code refactors setting env["LIBS"]
further down the script where it knows the system libraries to be built, and then creates the array with the correct linking order.
The previous env.Append(LIBS = ...)
is wrong here because it appends to the back and hence does not respect the original linker order laid out in the platform.txt
compiler.c.elf.libs=-lhal -lphy -lpp -lnet80211 {build.lwip_lib} -lwpa -lcrypto -lmain -lwps -lbearssl -lespnow -lsmartconfig -lairkiss -lwpa2 {build.stdcpp_lib} -lm -lc -lgcc |
---|