tinygo-org / tinygo

Go compiler for small places. Microcontrollers, WebAssembly (WASM/WASI), and command-line tools. Based on LLVM.
https://tinygo.org
Other
14.72k stars 858 forks source link

LLVM 18 support #4271

Closed aykevl closed 1 month ago

aykevl commented 1 month ago

2nd try, replaces https://github.com/tinygo-org/tinygo/pull/4266

github-actions[bot] commented 1 month ago

Size difference with the dev branch:

Binary size difference
not the same command!
    tinygo build -size short -o ./build/test.hex -target=feather-rp2040 ./examples/adafruit4650
    go: downloading tinygo.org/x/tinyfont v0.3.0
not the same command!
    tinygo build -size short -o ./build/test.hex -target=nano-rp2040 -stack-size 8kb ./examples/net/websocket/dial/
    go: downloading golang.org/x/net v0.7.0
not the same command!
    tinygo build -size short -o ./build/test.hex -target=nano-rp2040 -stack-size 8kb ./examples/net/mqttclient/natiu/
    go: downloading github.com/soypat/natiu-mqtt v0.5.1
not the same command!
    tinygo build -size short -o ./build/test.hex -target=wioterminal -stack-size 8kb ./examples/net/mqttclient/paho/
    go: downloading github.com/eclipse/paho.mqtt.golang v1.2.0
 flash                          ram
 before   after   diff          before   after   diff
 237804  236860   -944  -0.40%    8912    8912      0   0.00% tinygo build -size short -o ./build/test.hex -target=nano-rp2040 -stack-size 8kb ./examples/net/websocket/dial/
  15556   15200   -356  -2.29%    4740    4740      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/vl53l1x/main.go
 277268  276948   -320  -0.12%   17736   17736      0   0.00% tinygo build -size short -o ./build/test.hex -target=wioterminal -stack-size 8kb ./examples/net/webserver/
   4696    4448   -248  -5.28%    2264    2264      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/easystepper/main.go
 278140  277924   -216  -0.08%   16628   16628      0   0.00% tinygo build -size short -o ./build/test.hex -target=wioterminal -stack-size 8kb ./examples/net/mqttclient/paho/
  27540   27332   -208  -0.76%    4772    4772      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/bmp180/main.go
  13584   13380   -204  -1.50%    4740    4740      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/vl6180x/main.go
  67740   67556   -184  -0.27%    6352    6352      0   0.00% tinygo build -size short -o ./build/test.hex -target=feather-m0 ./examples/gps/i2c/main.go
   9996    9812   -184  -1.84%    4764    4764      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mcp23017/main.go
   8840    8660   -180  -2.04%    4740    4740      0   0.00% tinygo build -size short -o ./build/test.hex -target=feather-m0 ./examples/ina260/main.go
   9644    9468   -176  -1.82%    4740    4740      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/adxl345/main.go
   8212    8036   -176  -2.14%    4732    4732      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/bh1750/main.go
   8252    8076   -176  -2.13%    4732    4732      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/hcsr04/main.go
   8312    8136   -176  -2.12%    4740    4740      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mma8653/main.go
   8224    8048   -176  -2.14%    4732    4732      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mpu6050/main.go
  10820   10648   -172  -1.59%    4732    4732      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mag3110/main.go
  60968   60800   -168  -0.28%    6176    6176      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/adt7410/main.go
   7508    7340   -168  -2.24%    4732    4732      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/blinkm/main.go
  10416   10248   -168  -1.61%    4772    4772      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mcp23017-multiple/main.go
  31944   31784   -160  -0.50%    4772    4772      0   0.00% tinygo build -size short -o ./build/test.hex -target=trinket-m0 ./examples/bme280/main.go
  14532   14384   -148  -1.02%    4916    4916      0   0.00% tinygo build -size short -o ./build/test.hex -target=nucleo-wl55jc ./examples/sx126x/lora_rxtx/
  11764   11628   -136  -1.16%    4772    4772      0   0.00% tinygo build -size short -o ./build/test.hex -target=circuitplay-express ./examples/lis3dh/main.go
  12204   12084   -120  -0.98%    4804    4804      0   0.00% tinygo build -size short -o ./build/test.hex -target=trinket-m0 ./examples/bmp388/main.go
   9272    9152   -120  -1.29%    5236    5236      0   0.00% tinygo build -size short -o ./build/test.hex -target=nucleo-l432kc ./examples/aht20/main.go
   8304    8192   -112  -1.35%    4748    4748      0   0.00% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/max72xx/main.go
 108296  108184   -112  -0.10%    7244    7244      0   0.00% tinygo build -size short -o ./build/test.hex -target=arduino-mkrwifi1010 -stack-size 8kb ./examples/net/tlsclient/
  12808   12700   -108  -0.84%    4772    4772      0   0.00% tinygo build -size short -o ./build/test.hex -target=trinket-m0 ./examples/veml6070/main.go
   8560    8452   -108  -1.26%    4732    4732      0   0.00% tinygo build -size short -o ./build/test.uf2 -target=circuitplay-express ./examples/makeybutton/main.go
  81940   81836   -104  -0.13%    6588    6588      0   0.00% tinygo build -size short -o ./build/test.hex -target=nucleo-wl55jc ./examples/lora/lorawan/atcmd/
  63496   63400    -96  -0.15%    6208    6208      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/bmp280/main.go
  69276   69180    -96  -0.14%    6348    6348      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/ds3231/main.go
  16860   16764    -96  -0.57%    2344    2344      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/hub75/main.go
   7276    7180    -96  -1.32%    4732    4732      0   0.00% tinygo build -size short -o ./build/test.hex -target=xiao ./examples/pcf8563/clkout/
  26600   26512    -88  -0.33%    5100    5100      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit-v2 ./examples/microbitmatrix/main.go
  70304   70216    -88  -0.13%    6328    6320     -8  -0.13% tinygo build -size short -o ./build/test.hex -target=xiao ./examples/pcf8563/time/
  68168   68088    -80  -0.12%    6488    6488      0   0.00% tinygo build -size short -o ./build/test.hex -target=feather-m0 ./examples/gps/uart/main.go
  70776   70704    -72  -0.10%    6324    6316     -8  -0.13% tinygo build -size short -o ./build/test.hex -target=xiao ./examples/pcf8563/alarm/
  72152   72080    -72  -0.10%   10732   10732      0   0.00% tinygo build -size short -o ./build/test.hex -target=feather-m4 ./examples/sdcard/console/
  12228   12160    -68  -0.56%    3308    3308      0   0.00% tinygo build -size short -o ./build/test.hex -target=macropad-rp2040 ./examples/sh1106/macropad_spi
  10776   10716    -60  -0.56%    4860    4860      0   0.00% tinygo build -size short -o ./build/test.hex -target=xiao ./examples/ili9341/scroll
  10688   10632    -56  -0.52%    4852    4852      0   0.00% tinygo build -size short -o ./build/test.hex -target=xiao ./examples/ili9341/basic
  11172   11124    -48  -0.43%    3300    3300      0   0.00% tinygo build -size short -o ./build/test.hex -target=badger2040 ./examples/uc8151/main.go
   5604    5564    -40  -0.71%    2264    2264      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/hd44780/customchar/main.go
   5648    5608    -40  -0.71%    2264    2264      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/hd44780/text/main.go
  10432   10392    -40  -0.38%    4740    4740      0   0.00% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/hd44780i2c/main.go
  13644   13604    -40  -0.29%    3384    3384      0   0.00% tinygo build -size short -o ./build/test.hex -target=pico     ./examples/sgp30
  16908   16868    -40  -0.24%    4732    4732      0   0.00% tinygo build -size short -o ./build/test.hex -target=circuitplay-express ./examples/thermistor/main.go
  70696   70656    -40  -0.06%    6324    6324      0   0.00% tinygo build -size short -o ./build/test.hex -target=xiao ./examples/pcf8563/timer/
  12388   12356    -32  -0.26%    4780    4780      0   0.00% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/lsm6ds3/main.go
  12924   12892    -32  -0.25%    4732    4732      0   0.00% tinygo build -size short -o ./build/test.hex -target=circuitplay-express ./examples/lis2mdl/main.go
   8600    8576    -24  -0.28%    4732    4732      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/apa102/main.go
 263272  263248    -24  -0.01%   46736   46736      0   0.00% tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/ili9341/slideshow
   5988    5964    -24  -0.40%    2264    2264      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/ssd1306/spi_128x64/main.go
  16736   16716    -20  -0.12%    4308    4308      0   0.00% tinygo build -size short -o ./build/test.hex -target=feather-rp2040 ./examples/adafruit4650
   9204    9184    -20  -0.22%    4740    4740      0   0.00% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/l9110x/speed/main.go
  16364   16348    -16  -0.10%    4716    4716      0   0.00% tinygo build -size short -o ./build/test.hex -target=circuitplay-express ./examples/microphone/main.go
   9460    9444    -16  -0.17%    4748    4748      0   0.00% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/ds18b20/main.go
 112788  112772    -16  -0.01%   12596   12596      0   0.00% tinygo build -size short -o ./build/test.hex -target=wioterminal -stack-size 8kb ./examples/net/webclient/
  10056   10044    -12  -0.12%    6900    6900      0   0.00% tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/ili9341/basic
  10080   10068    -12  -0.12%    6908    6908      0   0.00% tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/ili9341/scroll
   9684    9672    -12  -0.12%    4732    4732      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mcp3008/main.go
   6676    6664    -12  -0.18%    4732    4732      0   0.00% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/l293x/simple/main.go
   8588    8576    -12  -0.14%    4732    4732      0   0.00% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/l293x/speed/main.go
   6640    6628    -12  -0.18%    4732    4732      0   0.00% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/l9110x/simple/main.go
  64852   64844     -8  -0.01%    8996    8996      0   0.00% tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/flash/console/qspi
  26012   26004     -8  -0.03%    2312    2312      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/lsm303agr/main.go
   6060    6052     -8  -0.13%    3272    3272      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/pcd8544/setbuffer/main.go
   5096    5088     -8  -0.16%    2264    2264      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/pcd8544/setpixel/main.go
   6800    6792     -8  -0.12%    4772    4772      0   0.00% tinygo build -size short -o ./build/test.hex -target=circuitplay-express ./examples/ws2812
   6912    6904     -8  -0.12%    2252    2252      0   0.00% tinygo build -size short -o ./build/test.hex -target=hifive1b ./examples/ssd1351/main.go
  64600   64592     -8  -0.01%    6248    6248      0   0.00% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/ndir/main_ndir.go
  88048   88040     -8  -0.01%    5820    5820      0   0.00% tinygo build -size short -o ./build/test.hex -target=challenger-rp2040 ./examples/net/ntpclient/
  22080   22076     -4  -0.02%    3528    3528      0   0.00% tinygo build -size short -o ./build/test.hex -target=bluepill ./examples/ds1307/time/main.go
   6604    6600     -4  -0.06%    2264    2264      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/st7735/main.go
   7708    7704     -4  -0.05%    4732    4732      0   0.00% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/ttp229/main.go
  10992   10992      0   0.00%    4732    4732      0   0.00% tinygo build -size short -o ./build/test.hex -target=circuitplay-express ./examples/buzzer/main.go
   8376    8376      0   0.00%    3744    3744      0   0.00% tinygo build -size short -o ./build/test.hex -target=macropad-rp2040 ./examples/encoders/quadrature-interrupt
 321372  321372      0   0.00%   15268   15268      0   0.00% tinygo build -size short -o ./build/test.hex -target=matrixportal-m4 -stack-size 8kb ./examples/net/webstatic/
  13476   13480      4   0.03%    6780    6780      0   0.00% tinygo build -size short -o ./build/test.hex -target=pybadge ./examples/amg88xx
  11584   11588      4   0.03%    6556    6556      0   0.00% tinygo build -size short -o ./build/test.hex -target=nano-33-ble ./examples/apds9960/proximity/main.go
   8172    8176      4   0.05%    2304    2304      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/at24cx/main.go
   7032    7036      4   0.06%    2264    2264      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/gc9a01/main.go
  29412   29416      4   0.01%   38060   38060      0   0.00% tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/ili9341/pyportal_boing
   5668    5672      4   0.07%    2264    2264      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/ssd1331/main.go
   9964    9968      4   0.04%    4732    4732      0   0.00% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/tm1637/main.go
   6372    6376      4   0.06%    2304    2304      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/waveshare-epd/epd2in13/main.go
   5996    6000      4   0.07%    2296    2296      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/waveshare-epd/epd2in13x/main.go
   6252    6256      4   0.06%    2304    2304      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/waveshare-epd/epd4in2/main.go
   7288    7292      4   0.05%    3304    3304      0   0.00% tinygo build -size short -o ./build/test.hex -target=nucleo-f103rb ./examples/shiftregister/main.go
   8128    8136      8   0.10%    3332    3332      0   0.00% tinygo build -size short -o ./build/test.hex -target=bluepill ./examples/ds1307/sram/main.go
  14504   14512      8   0.06%    6556    6556      0   0.00% tinygo build -size short -o ./build/test.hex -target=nano-33-ble ./examples/hts221/main.go
  13848   13856      8   0.06%    6556    6556      0   0.00% tinygo build -size short -o ./build/test.hex -target=nano-33-ble ./examples/lps22hb/main.go
  10384   10392      8   0.08%    3312    3312      0   0.00% tinygo build -size short -o ./build/test.hex -target=feather-rp2040 ./examples/seesaw
   6452    6460      8   0.12%    2272    2272      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/ssd1306/i2c_128x32/main.go
   6504    6512      8   0.12%    2264    2264      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/st7789/main.go
  10292   10300      8   0.08%    4516    4516      0   0.00% tinygo build -size short -o ./build/test.hex -target=circuitplay-bluefruit ./examples/tone
   9396    9404      8   0.09%    6772    6772      0   0.00% tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/touch/resistive/fourwire/main.go
  36336   36344      8   0.02%    3972    3972      0   0.00% tinygo build -size short -o ./build/test.hex -target=feather-rp2040 ./examples/pcf8523/
   9768    9776      8   0.08%    3280    3280      0   0.00% tinygo build -size short -o ./build/test.uf2 -target=pico ./examples/mpu6886/main.go
 151384  151392      8   0.01%    6176    6176      0   0.00% tinygo build -size short -o ./build/test.hex -target=nano-rp2040 -stack-size 8kb ./examples/net/mqttclient/natiu/
   7940    7952     12   0.15%    6780    6780      0   0.00% tinygo build -size short -o ./build/test.hex -target=pybadge ./examples/shifter/main.go
  12468   12480     12   0.10%    6984    6968    -16  -0.23% tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/touch/resistive/pyportal_touchpaint/main.go
   5506    5518     12   0.22%    9502    9502      0   0.00% tinygo build -size short -o ./build/test.bin -target=m5stamp-c3          ./examples/ws2812
   9652    9668     16   0.17%    4752    4752      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/apa102/itsybitsy-m0/main.go
  68820   68836     16   0.02%    6956    6956      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/flash/console/spi
  12116   12132     16   0.13%    3336    3336      0   0.00% tinygo build -size short -o ./build/test.hex -target=pico ./examples/pca9685/main.go
  12044   12060     16   0.13%    3288    3288      0   0.00% tinygo build -size short -o ./build/test.hex -target=pico ./examples/qmi8658c/main.go
  10276   10292     16   0.16%    3340    3340      0   0.00% tinygo build -size short -o ./build/test.uf2 -target=pico ./examples/scd4x/main.go
   9184    9200     16   0.17%    3272    3272      0   0.00% tinygo build -size short -o ./build/test.uf2 -target=pico ./examples/mpu9150/main.go
  15700   15720     20   0.13%    4860    4860      0   0.00% tinygo build -size short -o ./build/test.uf2 -target=pico ./examples/as560x/main.go
  66952   66976     24   0.04%    6176    6176      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mcp2515/main.go
   8884    8908     24   0.27%    3260    3260      0   0.00% tinygo build -size short -o ./build/test.uf2 -target=pico ./examples/xpt2046/main.go
  10144   10172     28   0.28%    6780    6780      0   0.00% tinygo build -size short -o ./build/test.elf -target=wioterminal ./examples/axp192/m5stack-core2-blinky/
   2681    2713     32   1.19%     556     558      2   0.36% tinygo build -size short -o ./build/test.hex -target=arduino ./examples/servo
   1709    1741     32   1.87%     596     598      2   0.34% tinygo build -size short -o ./build/test.hex -target=arduino   ./examples/ws2812
   1040    1072     32   3.08%     178     180      2   1.12% tinygo build -size short -o ./build/test.hex -target=digispark ./examples/ws2812
  26688   26728     40   0.15%    3056    3056      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/microbitmatrix/main.go
  11148   11192     44   0.39%    4236    4236      0   0.00% tinygo build -size short -o ./build/test.hex -target=pico ./examples/irremote/main.go
  63388   63444     56   0.09%    6176    6176      0   0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/bmi160/main.go
  76688   76744     56   0.07%    6316    6316      0   0.00% tinygo build -size short -o ./build/test.hex -target=feather-m0 ./examples/dht/main.go
  66120   66176     56   0.08%    4808    4808      0   0.00% tinygo build -size short -o ./build/test.hex -target=pico ./examples/ndir/main_ndir.go
  61472   61528     56   0.09%    3776    3776      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/ndir/main_ndir.go
  60780   60852     72   0.12%    8216    8216      0   0.00% tinygo build -size short -o ./build/test.hex -target=feather-m4 ./examples/i2csoft/adt7410/
  70420   70500     80   0.11%    3692    3692      0   0.00% tinygo build -size short -o ./build/test.hex -target=pinetime     ./examples/bma42x/main.go
 115924  116004     80   0.07%    7480    7480      0   0.00% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 -stack-size 8kb ./examples/net/tcpclient/
  61848   61936     88   0.14%    5928    5928      0   0.00% tinygo build -size short -o ./build/test.hex -target=feather-nrf52840 ./examples/is31fl3731/main.go
  56632   56736    104   0.18%    3668    3668      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/sht3x/main.go
  56688   56792    104   0.18%    3676    3676      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/sht4x/main.go
  56604   56708    104   0.18%    3668    3668      0   0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/shtc3/main.go
 100584  100720    136   0.14%    9472    9472      0   0.00% tinygo build -size short -o ./build/test.hex -target=metro-m4-airlift -stack-size 8kb ./examples/net/socket/
  75140   75284    144   0.19%    7460    7460      0   0.00% tinygo build -size short -o ./build/test.hex -target=p1am-100 ./examples/p1am/main.go
 233484  233652    168   0.07%    9968    9968      0   0.00% tinygo build -size short -o ./build/test.hex -target=pyportal -stack-size 8kb ./examples/net/http-get/
  29924   30100    176   0.59%    4020    4020      0   0.00% tinygo build -size short -o ./build/test.uf2 -target=pico ./examples/ssd1289/main.go
5037668 5032232  -5436  -0.00%  752652  752626    -26   0.00%
aykevl commented 1 month ago

Ready for review. The failed tests all seem to be problems with TinyHCI (devices not found), not necessarily a problem with this PR.

Unfortunately a change in LLVM 18 broke ld.lld for AVR (see https://github.com/llvm/llvm-project/pull/92695) so I had to patch LLVM. This means a few things:

While this problem will likely be fixed in LLVM 19, it will likely continue to be a problem for LLVM 18 because the LLVM team recently said there probably won't be any point releases for LLVM 18.x anymore.

deadprogram commented 1 month ago

AVR won't work correctly when linking against a system installed LLVM

So this only impacts people who want to compile for AVR targets, who are also building their own TinyGo, correct? And if LLVM releases 18.1.7 then problem solved?

If this is correct, then we can probably go ahead and merge this. For people using ARM, RISCV, or WASM targets this will not impact with dev versions while it gets sorted out.

aykevl commented 1 month ago

So this only impacts people who want to compile for AVR targets

Correct

who are also building their own TinyGo, correct?

Yes, but also for distributions that typically link against their own LLVM shared library. (But those distributions also don't support Xtensa, so AVR wouldn't be the only option). An example would be the Fedora tinygo package.

And if LLVM releases 18.1.7 then problem solved?

Yes... but it's unlikely they will. From the release notes:

There are no more planned 18.1.x releases, but there could be one if a critical issue is found. The release/19.x branch will be created on July 23, 2024.

So to get this fixed we'll probably have to wait until LLVM 19.

(...I should have tested LLVM 18 a while ago, so I could have gotten this fixed in a point release and not end up in this mess...).

In other news, this has been fixed in the LLVM main branch so it'll definitely be fixed in LLVM 19.

aykevl commented 1 month ago

A workaround would be to build TinyGo against LLVM 17, which remains possible. You can use go build -tags=llvm17 for this. So it not as big of a breakage as it might seem.

deadprogram commented 1 month ago

You can use go build -tags=llvm17 for this.

That works to resolve those specific use cases, and LLVM 19 will be here soon enough anyhow.

Now merging, thanks @aykevl

deadprogram commented 3 weeks ago

@aykevl just FYI https://github.com/llvm/llvm-project/releases/tag/llvmorg-18.1.7 was released after all. :smile:

aykevl commented 3 weeks ago

@deadprogram yeah I saw that, but that's only to fix a single bug (that was bad enough that Clang couldn't compile itself, so yeah pretty critical). It doesn't include this AVR linker fix.