Skip to content

Conversation

@SalarSamani
Copy link

No description provided.

LIBLWIP_CFLAGS-$(call have_clang) += -Wno-macro-redefined
LIBLWIP_CFLAGS-$(CONFIG_LWIP_DEBUG) += -DUK_DEBUG
LIBLWIP_CFLAGS-y += -D__IN_LIBLWIP__
LIBLWIP_CFLAGS-y += -DWORKAROUND_NEWLIB
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this could have a better name?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This name is suggested by chatGPT :D , if you think it is a bad suggestion I can change it ;)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this actually needed here? I don't see any changes related to this.

Comment on lines +47 to +49
#if ((defined CONFIG_ARCH_X86_64) || (defined CONFIG_ARCH_ARM_64))
#include <endian.h>
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this for x86 and arm only? I know we don't support the others that well, but do you believe that this would not work with RISCV for example?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code works for any 64-bit little-endian platform. I added this macro because some libraries, like lwIP, depend on the endianness of the system. When we add support for a new architecture, we must also add it here. If we don’t, we will get an error. That error is on purpose, it shows us that this code depends on the platform, and we need to update it (if it is needed for new platform). In this way, the errors help us remember what to consider when porting to new platforms.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine to not error on new architectures. It's expected for lwip to depend on endianess, and the point of endian.h is to make it transparent. So, I would remove the ifdefs.

Copy link
Member

@StefanJum StefanJum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, see the few comments, and also follow the general instructions from here unikraft/lib-python3#24

LIBLWIP_CFLAGS-$(call have_clang) += -Wno-macro-redefined
LIBLWIP_CFLAGS-$(CONFIG_LWIP_DEBUG) += -DUK_DEBUG
LIBLWIP_CFLAGS-y += -D__IN_LIBLWIP__
LIBLWIP_CFLAGS-y += -DWORKAROUND_NEWLIB
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this actually needed here? I don't see any changes related to this.

Comment on lines +47 to +49
#if ((defined CONFIG_ARCH_X86_64) || (defined CONFIG_ARCH_ARM_64))
#include <endian.h>
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine to not error on new architectures. It's expected for lwip to depend on endianess, and the point of endian.h is to make it transparent. So, I would remove the ifdefs.

Makefile.uk Outdated
LIBLWIP_SRCS-$(CONFIG_LWIP_THREADS) += $(LIBLWIP_BASE)/threads.c|unikraft
LIBLWIP_SRCS-y += $(LIBLWIP_BASE)/init.c|unikraft
LIBLWIP_SRCS-y += $(LIBLWIP_BASE)/time.c|unikraft
LIBLWIP_SRCS-y += $(LIBLWIP_BASE)/sendfile.c|unikraft
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this not needed anymore? Is it the same for musl builds?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants