Skip to content
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

Changes to enable linking with LLVM/lld #173

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake-tool/helpers/tls_rootserver.lds
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SECTIONS
*(.tdata .tdata.* .gnu.linkonce.td.*)
_tdata_end = . ;
}
.tbss :
.tbss (NOLOAD):
Copy link
Member

Choose a reason for hiding this comment

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

This is already implicitly present in the current toolchain right?

  5 .tbss         0000002c  016c3b90  016c3b90  016b3b8f  2**3
                  ALLOC, THREAD_LOCAL

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes that's correct for lld too. I just added NOLOAD here for intentionality and to avoid potential bugs with other linkers and/or older ones.

{
_tbss_start = . ;
*(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
Expand Down
2 changes: 1 addition & 1 deletion elfloader-tool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ config_option(
add_config_library(elfloader "${configure_string}")

add_compile_options(-D_XOPEN_SOURCE=700 -ffreestanding -Wall -Werror -W -Wextra)
set(linkerScript "${CMAKE_CURRENT_LIST_DIR}/src/arch-${KernelArch}/linker.lds")
set(linkerScript "${CMAKE_CURRENT_LIST_DIR}/src/linker.lds")
if(KernelArchRiscV)
add_compile_options(-mcmodel=medany)
endif()
Expand Down
6 changes: 6 additions & 0 deletions elfloader-tool/include/drivers/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ struct elfloader_driver {
extern struct elfloader_driver *__start__driver_list[];
extern struct elfloader_driver *__stop__driver_list[];

#if defined(__has_attribute) && __has_attribute(retain)
#define ELFLOADER_DRIVER(_name) \
const struct elfloader_driver *_driver_list_##_name \
__attribute__((unused,retain,section("_driver_list"))) = &_name;
#else
#define ELFLOADER_DRIVER(_name) \
const struct elfloader_driver *_driver_list_##_name \
__attribute__((unused,section("_driver_list"))) = &_name;
#endif
51 changes: 0 additions & 51 deletions elfloader-tool/src/arch-arm/linker.lds

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,14 @@ SECTIONS
*(.data.*)
}
. = ALIGN(16);
.bss :
.bss (NOLOAD) :
{
#ifdef CONFIG_ARCH_ARM
. = ALIGN(0x1000);
core_stack_alloc = .;
. += CONFIG_MAX_NUM_NODES * (1 << 12);
core_stack_alloc_end = .;
#endif
_bss = .;
*(.sbss*)
*(.bss)
Expand Down
Loading