patchlwIP - A Lightweight TCP/IP stack - Patches: patch #8742, lwIP fails to build with NO_SYS=1...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #8742: lwIP fails to build with NO_SYS=1 in single stack mode

Submitter:  Vlad Lungu <vlungu>
Submitted:  Wed 16 Sep 2015 04:20:07 PM UTC
   
 
Category:  None Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  goldsimon Open/Closed:  Closed
Planned Release:  None

Jump to the original submission

Thu 17 Sep 2015 08:45:59 AM UTC, comment #8: 

IAR7 on Cortex-M3 creates 2 dedicated functions even if only calling the function (not explicitly taking its address). However, the 2nd function is only 2 byte (jump to first function). I don't think this is a problem regarding size or performance.

Simon Goldschmidt <goldsimon>
Group administrator
Wed 16 Sep 2015 08:11:12 PM UTC, comment #7: 

Fixed in another way, thanks for reporting!

Simon Goldschmidt <goldsimon>
Group administrator
Wed 16 Sep 2015 07:26:36 PM UTC, comment #6: 

After testing a bit more, there is a limit though, if both pointer of functions are used, then it cannot be optimized. This is probably so that both functions does not have the same address if function pointer comparison is used.

Sylvain Rochet <gradator>
Group Member
Wed 16 Sep 2015 07:10:46 PM UTC, comment #5: 

Great! I will check IAR tomorrow ;-)

Simon Goldschmidt <goldsimon>
Group administrator
Wed 16 Sep 2015 07:03:04 PM UTC, comment #4: 

OK, you made me doubt ;-), so I checked, at least with gcc:


#include <stdio.h>

static int test_a(void);
static int test_b(void);

static int test_a(void) {
        test_b();
}

static int test_b(void) {
        printf("Hello World !\n");
        printf("Hello World !\n");
        printf("Hello World !\n");
}

static int caller(int (*f)(void)) {
        return f();
}

int main() {
        test_b();
        caller(test_a);
}

$ gcc -O2 -o test test.c && nm -S ./test | grep test_
0000000000400520 0000000000000026 t test_b


test_a() was aliased into test_b()

Sylvain Rochet <gradator>
Group Member
Wed 16 Sep 2015 06:41:00 PM UTC, comment #3: 


> Is that so?


Yes, a function which only calls a function (so a function which couldn't be more smaller) is going to be inlined.

Sylvain Rochet <gradator>
Group Member
Wed 16 Sep 2015 06:27:36 PM UTC, comment #2: 


> compilers are smart enough to remove a function call that do
> nothing else than calling a function.


Is that so? Anyway, even if not, that's fine by me. The proposed patch has the downside of still breaking old applications on upgrade, which I'd like to prevent.

Simon Goldschmidt <goldsimon>
Group administrator
Wed 16 Sep 2015 06:17:42 PM UTC, comment #1: 

I don't really like the proposed fix. We should just revert back ip_input() to always be a function, compilers are smart enough to remove a function call that do nothing else than calling a function.

Sylvain Rochet <gradator>
Group Member
Wed 16 Sep 2015 04:20:07 PM UTC, original submission:  

In src/core/netif.c, netif_init() does
netif_add(&loop_netif, ... , ip_input)

but ip_input() is a macro unless both LWIP_IPV4 and LWIP_IPV6 are
set to 1.

I have ifdefed the netif_add() call to use ip4_imput()/ip6_input() when needed.

Vlad Lungu <vlungu>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by gradator (Posted a comment)
  • -email is unavailable- added by vlungu (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-09-16 goldsimon StatusNone Done
        Assigned toNone goldsimon
        Open/ClosedOpen Closed
    2015-09-16 vlungu Attached File- Added 0001-Fix-build-error-for-NO_SYS-1-LWIP_IPV4-1-LWIP_IPV6-0.patch, #34903

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code