Skip to content

Update compiler toolchain to 3.2.0 #8868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 29, 2023
Merged

Conversation

earlephilhower
Copy link
Collaborator

Includes compiler updates from @jjsuwa-sys3175

Includes compiler updates from @jjsuwa-sys3175
@earlephilhower

This comment was marked as outdated.

@jjsuwa-sys3175
Copy link
Contributor

jjsuwa-sys3175 commented Feb 25, 2023

Thanks for building the toolchain :)

For the time being, regression tests have been done when merging to gcc mainline, so it shouldn't be completely unusable...

I checked the build of "fsbrowser" and the actual chip operation check for each patch submission.

Notable changes:

  • Preliminary -mlra option added (not ready for use yet)
  • Always save register A0 (function return address) to stack when -Og is specified, even for leaf functions
  • Improved register allocation efficiency by removing RA tweak remnants that no longer worked
  • Related to the above, the order of register allocation has changed
  • Once register A0 has been saved to the stack in the function prologue, the compiler may assign register A0 to variables or intermediate values in the function body
  • Improved inefficiency in automatic char array initialization.
    /* example */
    void test(void) {
      char buffer[32] = { 0, 0, 0, 0, 0, };
      asm volatile("" : : "m"(buffer));
    }
    
    ;; before
    .LC0:
    	.string	""
    	.string	""
    	.string	""
    	.string	""
    	.string	""
    	.string	""
    	.zero	26
    	.literal_position
    	.literal .LC1, .LC0
    test:
    	addi	sp, sp, -48
    	l32r	a3, .LC1
    	movi.n	a4, 6
    	mov.n	a2, sp
    	s32i.n	a0, sp, 44
    	call0	memcpy
    	addi.n	a2, sp, 6
    	addi	a3, sp, 32
    	movi.n	a4, 0
    .L2:
    	s16i	a4, a2, 0
    	addi.n	a2, a2, 2
    	bne	a2, a3, .L2
    	l32i.n	a0, sp, 44
    	addi	sp, sp, 48
    	ret.n
    
    ;; after
    test:
    	addi	sp, sp, -32
    	mov.n	a9, sp
    	addi	a10, sp, 32
    	movi.n	a11, 0
    .L2:
    	s32i.n	a11, a9, 0
    	addi.n	a9, a9, 4
    	bne	a9, a10, .L2
    	addi	sp, sp, 32
    	ret.n
    

@earlephilhower
Copy link
Collaborator Author

I've run about a dozen examples (LittleFS, WiFi, HTTPClient, Arduino core, WebServer) and had no issues, so I think this is good to go whenever you guys want to update the toolchain.

@d-a-v d-a-v added the alpha included in alpha release label Feb 26, 2023
@TD-er
Copy link
Contributor

TD-er commented Feb 27, 2023

Is LTO also supported with this updated toolchain?
If not, what is needed to support it?
On my ESP32 builds, it makes a difference of roughly 5 - 7% in binary size. (with debug symbols still included)

@earlephilhower
Copy link
Collaborator Author

Not supported. If I remember correctly many years ago igrr tried LTO and had serious issues with the way it handled weak functions.

This is just the latest patches back ported from the upstream GCC later versions with some size and speed optimizations.

@TD-er
Copy link
Contributor

TD-er commented Feb 27, 2023

with some size and speed optimizations.

OK, fair enough. Let's hope those size optimizations are already helping out then...

@d-a-v d-a-v merged commit ce9e720 into esp8266:master Mar 29, 2023
@earlephilhower earlephilhower deleted the tool320 branch March 29, 2023 15:56
hasenradball pushed a commit to hasenradball/Arduino that referenced this pull request Nov 18, 2024
* Update compiler toolchain to 3.2.0

Includes compiler updates from @jjsuwa-sys3175

* Manually update python3-via-env tools
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alpha included in alpha release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants