AVR C Runtime Library - Bugs: bug #50811, using -Wl,-u,vfprintf -lprintf_min...
You are not allowed to post comments on this tracker with your current authentication level.
bug #50811: using -Wl,-u,vfprintf -lprintf_min causes program to grow a lot
Submitter: | None | ||
Submitted: | Sat 15 Apr 2017 11:38:22 PM UTC | ||
Category: | None | Severity: | 3 - Normal |
Priority: | 5 - Normal | Item Group: | None |
Status: | None | Percent Complete: | 0% |
Assigned to: | None | Originator Email: | -email is unavailable- |
Open/Closed: | Open | Release: | 2.0.0 |
Fixed Release: | None |
( Jump to the original submission )
Tue 09 May 2017 08:55:01 PM UTC, comment #9: |
Georg-Johann Lay <gjlayde> |
Tue 18 Apr 2017 06:02:58 AM UTC, comment #8:
|
Joerg Wunsch <joerg_wunsch>![]() |
Mon 17 Apr 2017 09:04:22 PM UTC, comment #7: If that's the case, why provide an optimized version of printf() for constant strings at all? I guess maybe it happens inevitably due to compiler machinations.
|
Anonymous |
Mon 17 Apr 2017 08:07:54 PM UTC, comment #6: Well, the fact that the -u vfprintf needs to be forced is
|
Joerg Wunsch <joerg_wunsch>![]() |
Mon 17 Apr 2017 07:19:55 PM UTC, comment #5: I guess my point is that this statement (by itself) is false:
|
Dave Hylands <dhylands> |
Mon 17 Apr 2017 06:54:57 PM UTC, comment #4: You're correct, there's no reason when printf isn't being used to use those linker options. However:
|
Anonymous |
Mon 17 Apr 2017 04:46:35 PM UTC, comment #3: Using _Wl,-u,vfprintf is essentially forcing the symbol vfprintf to be undefined and added to the program. This is what's causing your code size to increase when not otherwise using vfprintf.
|
Dave Hylands <dhylands> |
Mon 17 Apr 2017 06:18:07 AM UTC, comment #2: Ok, with printf("foo: %d\n, 42), the program is indeed smaller with by 264 bytes when -Wl,-u,vfprintf -lprintf_min is used than when none of the printf linker flags are used.
|
Anonymous |
Sun 16 Apr 2017 09:11:13 PM UTC, comment #1: Calling printf("foo\n"); will be optimized to puts("foo"); so your test isn't really valid.
|
Dave Hylands <dhylands> |
Sat 15 Apr 2017 11:38:22 PM UTC, original submission:
|
Anonymous |
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
Re. the "compiler thing" mentioned above:
avr-gcc might replace a call to printf by a call to puts provided the arguments of printf allows to do so. You can avoid this optimization by means of -fno-builtin-printf which takes away any knowledge (except prototype information) about printf from the compiler. This will result in a call to printf (which you are using anyway), saving the call to fputs.