-
Notifications
You must be signed in to change notification settings - Fork 89
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
base: master
Are you sure you want to change the base?
Commits on Jan 15, 2024
-
tls_rootserver.lds: Add NOLOAD to .tbss section
Like .bss, .tbss needs explicit NONLOAD to ensure they are not allocated/loaded in the ELF image. Sponsored by: DARPA. Signed-off-by: Hesham Almatary <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for c85d38f - Browse repository at this point
Copy the full SHA c85d38fView commit details -
elfloader/linker: Retain _driver_list section
unused attribute does not prevent the section from being garbage-collected during link-time optimisation. This may trigger undefined references errors to [__start|__stop]_driver_list symbols that are expected to be emitted by the linker anyway. Adding "retain" attribute makes sure that the section and its associated symbols are kept regardless of linker's garbage collection. Another fix could be adding "nostart-stop-gc" to the linker flags, but since it is only one section (_driver_list) where its __start/__stop symbols are references, adding retain to it makes more sense. This additional functionality requires binutils version 2.36 or later. Sponsored by: DARPA. Signed-off-by: Hesham Almatary <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 921184a - Browse repository at this point
Copy the full SHA 921184aView commit details -
elfloader/linker: Add NOLOAD to .bss
Most linkers heuristically recognise common section names and apply the proper flags to them. .[t]bss sections for example should be recognised and linkers mark them ALLOC, NOLOAD, which means that they don't occupy space in the ELF image and shouldn't be loaded at run-time, but they should be allocated space at run-time in the process image when loaded. Adding NOLOAD (similar to the seL4's kernel) is good for intentionality, and for linkers that might not automatically flag .[t]bss at NOLOAD. Sponsored by: DARPA. Signed-off-by: Hesham Almatary <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 76236d3 - Browse repository at this point
Copy the full SHA 76236d3View commit details -
elfloader/linker: Fix arithmetic in the linker script
Linker's operators precedence [1] which follows C makes "+" higher than shifting "<<". Thus, ". + CONFIG_MAX_NODES" will be shifted by 12 in this case, which is wrong and is not the intended behavior. In lld (which properly implements C's operators precedence, unlike ld.bfd), the arithmetic results in a significant value. The outcome is either a huge ELF file size, or a linking error (e.g., relocation R_AARCH64_ADR_PREL_PG_HI21 out of range). This commit fixes the arithmetic and uses += which is more portable. [1] https://sourceware.org/binutils/docs/ld.html Sponsored by: DARPA. Signed-off-by: Hesham Almatary <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for db8d245 - Browse repository at this point
Copy the full SHA db8d245View commit details -
elfloader/linker: Unify linker.lds in one file
This allows to use the same file for both Arm and RISC-V. Furthermore, this new file is more portable and works with both LLVM/lld and GNU's ld, unlike the removed Arm's one which contains directives and sections that lld does not handle (e.g., .interp, INSERT BEFORE .hash). Signed-off-by: Hesham Almatary <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 843b0c9 - Browse repository at this point
Copy the full SHA 843b0c9View commit details