OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 2:27 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 36 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Raspberry PI Bare Bones OS
PostPosted: Wed May 26, 2021 10:42 pm 
Offline

Joined: Wed May 26, 2021 10:35 pm
Posts: 13
Yes, I am not informed, yes, I tried looking around, yes, all information is there but none of it what I am looking for.

(I welcome you to point me in the right direction/link the correct pages if I have missed them.)

I was following https://wiki.osdev.org/Raspberry_Pi_Bare_Bones
and other tutorials and trying to learn, and they want you to install a "cross compiler"

However, there seems to be none tutorials/explanation at all if you want to create a raspberry pi OS from within itself.

If I have missed such pages, well, search engines are pretty bad these days, please give me a correct link!

Otherwise, I would like to avoid any dependencies or "cross compilers" and just compile/link manually from a raspberry pi, before flashing onto another SD.

thanks


Top
 Profile  
 
 Post subject: Re: Raspberry PI Bare Bones OS
PostPosted: Thu May 27, 2021 11:56 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9301
Location: On the balcony, where I can actually keep 1½m distance
ssjcoder wrote:
However, there seems to be none tutorials/explanation at all if you want to create a raspberry pi OS from within itself.
The cross-compiler tutorial is meant to work quite universally, and you should be able to follow the same steps on a raspberry running Linux as you would on a desktop computer. There might be some hardware limitations that you may run into, I haven't personally tried this myself.

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


Top
 Profile  
 
 Post subject: Re: Raspberry PI Bare Bones OS
PostPosted: Thu May 27, 2021 12:51 pm 
Offline
Member
Member

Joined: Thu May 17, 2007 1:27 pm
Posts: 999
To slightly elaborate what Combuster said: you should (probably) still build a cross compiler even when developing on the Pi itself -- while your distro might already provie a aarch64-linux-gcc, you want a aarch64-elf-gcc to build your own OS. The -linux- gcc will try to use a hosted libgcc configuration; it will also enable a bunch of features (like stack guards, PIE, etc.) that do not work without runtime support (but most of these can be turned off via command line switches).

The Pi 4 has multiple GiB of memory, so building GCC should not be an issue (llvm might be a different story).

_________________
managarm: Microkernel-based OS capable of running a Wayland desktop (Discord: https://discord.gg/7WB6Ur3). My OS-dev projects: [mlibc: Portable C library for managarm, qword, Linux, Sigma, ...] [LAI: AML interpreter] [xbstrap: Build system for OS distributions].


Top
 Profile  
 
 Post subject: Re: Raspberry PI Bare Bones OS
PostPosted: Thu May 27, 2021 4:13 pm 
Offline

Joined: Wed May 26, 2021 10:35 pm
Posts: 13
Quote:
The cross-compiler tutorial is meant to work quite universally, and you should be able to follow the same steps on a raspberry running Linux as you would on a desktop computer. There might be some hardware limitations that you may run into, I haven't personally tried this myself.


Understandable, however, is there no documentation on the gcc compiler flags/ "as" command on raspberry pi/linux that could help me achieve what the cross compiler achieves without going through any extra steps?

Quote:
To slightly elaborate what Combuster said: you should (probably) still build a cross compiler even when developing on the Pi itself -- while your distro might already provie a aarch64-linux-gcc, you want a aarch64-elf-gcc to build your own OS. The -linux- gcc will try to use a hosted libgcc configuration; it will also enable a bunch of features (like stack guards, PIE, etc.) that do not work without runtime support (but most of these can be turned off via command line switches).


Well, my hope is that those command-line switches aren't lost in the ether and are actually documented somewhere, so if you have any pages/links/information/books (free ones) I'd appreciate.

Quote:
The Pi 4 has multiple GiB of memory, so building GCC should not be an issue (llvm might be a different story).


I have a raspberry pi 3B, 4 ports of USB, 1 GB of RAM (if I'm not mistaken).

So, thank you guys for the input, I will use the cross compiler maybe if there is absolutely no other way, but hope that somebody knows where I can educate myself on the default flags for "as" / "gcc" commands/compilers on the raspberry pi operating system.

Also, when using "gcc -dumpmachine" it displays "arm-linux-gnueabihf", not sure how useful that info is.

Any more help will be appreciated!


Top
 Profile  
 
 Post subject: Re: Raspberry PI Bare Bones OS
PostPosted: Thu May 27, 2021 5:37 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
ssjcoder wrote:
Understandable, however, is there no documentation on the gcc compiler flags/ "as" command on raspberry pi/linux that could help me achieve what the cross compiler achieves without going through any extra steps?

There is none. The required flags change over time as new compiler features are enabled, and no one wants to bother trying to keep up when it's so much easier to use a cross-compiler.

On the other hand, most developers use an actual PC that can handle building a cross-compiler. Why are you using a Raspberry Pi?


Top
 Profile  
 
 Post subject: Re: Raspberry PI Bare Bones OS
PostPosted: Thu May 27, 2021 5:56 pm 
Offline

Joined: Wed May 26, 2021 10:35 pm
Posts: 13
Quote:
There is none. The required flags change over time as new compiler features are enabled, and no one wants to bother trying to keep up when it's so much easier to use a cross-compiler.


aight. If anyone else has any more information I'll take it.

Quote:
On the other hand, most developers use an actual PC that can handle building a cross-compiler. Why are you using a Raspberry Pi?


a Raspberry PI actually has an incredible amount of power, if you look at Moore's law, and etc, you will see that the Raspberry PI is actually a very high end power machine compared to what we had 20 yrs ago.

Even if I had 1,000,000x more power doesn't mean I'm just gonna go and use all that power to compile 1,000,000 more than what I need.

bloat. it's a thing.

I want people who can give me efficient answers. I want to know how to make a minimalist bootloader, I'm sure there is a way, or do I literally have to make my own processor chip?

I will leave this open for people who can answer my question. If there is no answer then fine, let the post die, then I will figure something else out. nevertheless, the post is here in case someone knows how to get this going.

hacks also accepted.

--thanks


Top
 Profile  
 
 Post subject: Re: Raspberry PI Bare Bones OS
PostPosted: Thu May 27, 2021 6:00 pm 
Offline
Member
Member

Joined: Mon Feb 02, 2015 7:11 pm
Posts: 898
I do maintain some Makefile to build cross-compilers for the RPI3. It works for both ARM and AARCH64.

That said, I started adding things specific to my OS in it... But it could be used as a starting point or to lookup which flags you need to configure GCC.

Take a look here:
https://github.com/kiznit/rainbow-os/tr ... /toolchain

Basically you want to make sure you use "--with-multilib-list=aprofile" for ARM and "--enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419" for AARCH64.

When compiling source code for ARM, you want to use these for RPI3:
-mfloat-abi=hard -march=armv8-a+crc -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8

And for AARCH64:
-march=armv8-a+crc -mtune=cortex-a53

_________________
https://github.com/kiznit/rainbow-os


Top
 Profile  
 
 Post subject: Re: Raspberry PI Bare Bones OS
PostPosted: Fri May 28, 2021 12:02 am 
Offline
Member
Member

Joined: Thu May 17, 2007 1:27 pm
Posts: 999
The info that you're looking for (= the command lines switches required to turn your hosted compiler into a freestanding one) is distro- and GCC-version-specific that's why nobody is maintaining a list. You will need stuff like -ffreestanding -fno-stack-protector -fno-pie -no-pie -mgeneral-regs-only.

_________________
managarm: Microkernel-based OS capable of running a Wayland desktop (Discord: https://discord.gg/7WB6Ur3). My OS-dev projects: [mlibc: Portable C library for managarm, qword, Linux, Sigma, ...] [LAI: AML interpreter] [xbstrap: Build system for OS distributions].


Top
 Profile  
 
 Post subject: Re: Raspberry PI Bare Bones OS
PostPosted: Fri May 28, 2021 12:57 pm 
Offline
Member
Member

Joined: Sun Jun 23, 2019 5:36 pm
Posts: 618
Location: North Dakota, United States
The only way you can avoid a cross-compiler build is with clang/LLVM or a language that uses LLVM under the hood like Rust. (I use Rust which is backed by LLVM and I've never needed to build LLVM for OSDev. But maybe Rust does strange things.) Generally, you can use the targets that come with Clang for cross-compilation (see https://clang.llvm.org/docs/CrossCompilation.html). For a list of targets, use --print-targets when using clang. I'm not precisely sure what your target would be in this instance -- but for AArch64 it'd be something like aarch64v8a-pc-none-elf. But don't quote me on that. You'll still need a linker script and you might need a ton of command-line options, but Clang makes it doable.


Top
 Profile  
 
 Post subject: Re: Raspberry PI Bare Bones OS
PostPosted: Sat May 29, 2021 2:24 am 
Offline
Member
Member

Joined: Thu May 17, 2007 1:27 pm
Posts: 999
You didn't need to build Rust, but you probably need to build compiler-rt.

And if you want to use Rust in userspace, you need to patch both Rust (and the libc and std crates) and LLVM.

_________________
managarm: Microkernel-based OS capable of running a Wayland desktop (Discord: https://discord.gg/7WB6Ur3). My OS-dev projects: [mlibc: Portable C library for managarm, qword, Linux, Sigma, ...] [LAI: AML interpreter] [xbstrap: Build system for OS distributions].


Top
 Profile  
 
 Post subject: Re: Raspberry PI Bare Bones OS
PostPosted: Sat May 29, 2021 3:29 pm 
Offline

Joined: Wed May 26, 2021 10:35 pm
Posts: 13
Korona wrote:
The info that you're looking for (= the command lines switches required to turn your hosted compiler into a freestanding one) is distro- and GCC-version-specific that's why nobody is maintaining a list. You will need stuff like -ffreestanding -fno-stack-protector -fno-pie -no-pie -mgeneral-regs-only.


Thanks, why can't I use these flags in default GCC? Is there no way to get exact version of my gcc, and no way to extract/read available flags to said version?

Sounds like it's just v. poorly documented, is there no command on gcc to list all flags and what they do, for example? (which would obv. differ per version)

-- thanks also to others for posting more information

My thoughts is that if gcc is this difficult to work with I will look into other options such as easy to use, minimalist bootloaders, assuming they exist.

Feel free to post recommendations, thanks!

EDIT
Come to think of it, your PC has to store available flags somewhere no? So, if anyone can help me extract all valid flags on my system that might be a step in the right direction


Top
 Profile  
 
 Post subject: Re: Raspberry PI Bare Bones OS
PostPosted: Sat May 29, 2021 11:36 pm 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4591
Location: Chichester, UK
You could start by reading the GCC documentation, which lists the compiler flags.


Top
 Profile  
 
 Post subject: Re: Raspberry PI Bare Bones OS
PostPosted: Sun May 30, 2021 12:09 am 
Offline

Joined: Wed Aug 05, 2020 3:38 pm
Posts: 9
ssjcoder wrote:
Thanks, why can't I use these flags in default GCC? Is there no way to get exact version of my gcc, and no way to extract/read available flags to said version?

Presumably, by default GCC you mean GCC distributed with your system. The thing is, telling us that does not give much information (we have no idea what patches were applied and for what revision of GCC by your distributor). One could use their distributors GCC to build systems all the way to needing a userspace cross compiler, assuming they stick to the same executable format and architecture, but it may be more work, or it may be unclear and unreproducible, and hence harder for us to help you.

As for a list of flags, GCC provides manual pages (man gcc), and ``gcc --help'', which could both be of use to you. It also provides texinfo pages, but texinfo is arcane magic that I fail to understand.

As this post is about RPI, and (presumably) you run an amd64 based pc, not an aarch64/arm one, you will probably need a cross compiler anyway.


Top
 Profile  
 
 Post subject: Re: Raspberry PI Bare Bones OS
PostPosted: Sun May 30, 2021 2:21 pm 
Offline

Joined: Wed May 26, 2021 10:35 pm
Posts: 13
iansjack wrote:
You could start by reading the GCC documentation, which lists the compiler flags.


Will be looking at more of the documentation, thanks

ArsenArsen wrote:
ssjcoder wrote:
As this post is about RPI, and (presumably) you run an amd64 based pc, not an aarch64/arm one, you will probably need a cross compiler anyway.


No I am doing all work on my ras pi onto a second SD card that I will use on the same raspberry pi for testing purposes, this is because my main machine is currently unaccessible to me, and I will only be working on another machine probably mid way through next month at the earliest. (meaning I have only a ras pi and nothing else until next month)

Here is the "--help" command dump:

Code:
pi@raspberrypi:~ $ gcc --help
Usage: gcc [options] file...
Options:
  -pass-exit-codes         Exit with highest error code from a phase.
  --help                   Display this information.
  --target-help            Display target specific command line options.
  --help={common|optimizers|params|target|warnings|[^]{joined|separate|undocumented}}[,...].
                           Display specific types of command line options.
  (Use '-v --help' to display command line options of sub-processes).
  --version                Display compiler version information.
  -dumpspecs               Display all of the built in spec strings.
  -dumpversion             Display the version of the compiler.
  -dumpmachine             Display the compiler's target processor.
  -print-search-dirs       Display the directories in the compiler's search path.
  -print-libgcc-file-name  Display the name of the compiler's companion library.
  -print-file-name=<lib>   Display the full path to library <lib>.
  -print-prog-name=<prog>  Display the full path to compiler component <prog>.
  -print-multiarch         Display the target's normalized GNU triplet, used as
                           a component in the library path.
  -print-multi-directory   Display the root directory for versions of libgcc.
  -print-multi-lib         Display the mapping between command line options and
                           multiple library search directories.
  -print-multi-os-directory Display the relative path to OS libraries.
  -print-sysroot           Display the target libraries directory.
  -print-sysroot-headers-suffix Display the sysroot suffix used to find headers.
  -Wa,<options>            Pass comma-separated <options> on to the assembler.
  -Wp,<options>            Pass comma-separated <options> on to the preprocessor.
  -Wl,<options>            Pass comma-separated <options> on to the linker.
  -Xassembler <arg>        Pass <arg> on to the assembler.
  -Xpreprocessor <arg>     Pass <arg> on to the preprocessor.
  -Xlinker <arg>           Pass <arg> on to the linker.
  -save-temps              Do not delete intermediate files.
  -save-temps=<arg>        Do not delete intermediate files.
  -no-canonical-prefixes   Do not canonicalize paths when building relative
                           prefixes to other gcc components.
  -pipe                    Use pipes rather than intermediate files.
  -time                    Time the execution of each subprocess.
  -specs=<file>            Override built-in specs with the contents of <file>.
  -std=<standard>          Assume that the input sources are for <standard>.
  --sysroot=<directory>    Use <directory> as the root directory for headers
                           and libraries.
  -B <directory>           Add <directory> to the compiler's search paths.
  -v                       Display the programs invoked by the compiler.
  -###                     Like -v but options quoted and commands not executed.
  -E                       Preprocess only; do not compile, assemble or link.
  -S                       Compile only; do not assemble or link.
  -c                       Compile and assemble, but do not link.
  -o <file>                Place the output into <file>.
  -pie                     Create a dynamically linked position independent
                           executable.
  -shared                  Create a shared library.
  -x <language>            Specify the language of the following input files.
                           Permissible languages include: c c++ assembler none
                           'none' means revert to the default behavior of
                           guessing the language based on the file's extension.

Options starting with -g, -f, -m, -O, -W, or --param are automatically
passed on to the various sub-processes invoked by gcc.  In order to pass
other options on to these processes the -W<letter> options must be used.

For bug reporting instructions, please see:
<file:///usr/share/doc/gcc-8/README.Bugs>.


Here is the "--version" command dump:
Code:
pi@raspberrypi:~ $ gcc --version
gcc (Raspbian 8.3.0-6+rpi1) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Here is "--target-help" command dump:
Code:
pi@raspberrypi:~ $ gcc --target-help
The following options are target specific:
  -mabi=                      Specify an ABI.
  -mabort-on-noreturn         Generate a call to abort if a noreturn function
                              returns.
  -mandroid                   Generate code for the Android platform.
  -mapcs-frame                Generate APCS conformant stack frames.
  -mapcs-reentrant            Generate re-entrant, PIC code.
  -march=                     Specify the name of the target architecture.
  -marm                       Generate code in 32 bit ARM state.
  -masm-syntax-unified        Assume unified syntax for inline assembly code.
  -mbe32                      When linking for big-endian targets, generate a
                              legacy BE32 format image.
  -mbe8                       When linking for big-endian targets, generate a
                              BE8 format image.
  -mbig-endian                Assume target CPU is configured as big endian.
  -mbionic                    Use Bionic C library.
  -mbranch-cost=              Cost to assume for a branch insn.
  -mcallee-super-interworking Thumb: Assume non-static functions may be called
                              from ARM code.
  -mcaller-super-interworking Thumb: Assume function pointers may go to non-
                              Thumb aware code.
  -mcmse                      Specify that the compiler should target secure
                              code as per ARMv8-M Security Extensions.
  -mcpu=                      Specify the name of the target CPU.
  -mfix-cortex-m3-ldrd        Avoid overlapping destination and address
                              registers on LDRD instructions that may trigger
                              Cortex-M3 errata.
  -mfloat-abi=                Specify if floating point hardware should be used.
  -mfp16-format=              Specify the __fp16 floating-point format.
  -mfpu=                      Specify the name of the target floating point
                              hardware/format.
  -mglibc                     Use GNU C library.
  -mlittle-endian             Assume target CPU is configured as little endian.
  -mlong-calls                Generate call insns as indirect calls, if
                              necessary.
  -mmusl                      Use musl C library.
  -mneon-for-64bits           Use Neon to perform 64-bits operations rather
                              than core registers.
  -mpic-data-is-text-relative Assume data segments are relative to text segment.
  -mpic-register=             Specify the register to be used for PIC
                              addressing.
  -mpoke-function-name        Store function names in object code.
  -mprint-tune-info           Print CPU tuning information as comment in
                              assembler file.  This is an option used only for
                              regression testing of the compiler and not
                              intended for ordinary use in compiling code.
  -mpure-code                 Do not allow constant data to be placed in code
                              sections.
  -mrestrict-it               Generate IT blocks appropriate for ARMv8.
  -msched-prolog              Permit scheduling of a function's prologue
                              sequence.
  -msingle-pic-base           Do not load the PIC register in function
                              prologues.
  -mslow-flash-data           Assume loading data from flash is slower than
                              fetching instructions.
  -mstructure-size-boundary=  Specify the minimum bit alignment of structures.
                              (Deprecated).
  -mthumb                     Generate code for Thumb state.
  -mthumb-interwork           Support calls between Thumb and ARM instruction
                              sets.
  -mtls-dialect=              Specify thread local storage scheme.
  -mtp=                       Specify how to access the thread pointer.
  -mtpcs-frame                Thumb: Generate (non-leaf) stack frames even if
                              not needed.
  -mtpcs-leaf-frame           Thumb: Generate (leaf) stack frames even if not
                              needed.
  -mtune=                     Tune code for the given processor.
  -muclibc                    Use uClibc C library.
  -munaligned-access          Enable unaligned word and halfword accesses to
                              packed data.
  -mvectorize-with-neon-double Use Neon double-word (rather than quad-word)
                              registers for vectorization.
  -mvectorize-with-neon-quad  Use Neon quad-word (rather than double-word)
                              registers for vectorization.
  -mword-relocations          Only generate absolute relocations on word sized
                              values.

  Known ARM ABIs (for use with the -mabi= option):
    aapcs aapcs-linux apcs-gnu atpcs iwmmxt

  Known __fp16 formats (for use with the -mfp16-format= option):
    alternative ieee none

  Known ARM FPUs (for use with the -mfpu= option):
    auto crypto-neon-fp-armv8 fp-armv8 fpv4-sp-d16 fpv5-d16 fpv5-sp-d16 neon
    neon-fp-armv8 neon-fp16 neon-vfpv3 neon-vfpv4 vfp vfp3 vfpv2 vfpv3 vfpv3-d16
    vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16

  Valid arguments to -mtp=:
    auto cp15 soft

  Known floating-point ABIs (for use with the -mfloat-abi= option):
    hard soft softfp

  TLS dialect to use:
    gnu gnu2

Assembler options
=================

Use "-Wa,OPTION" to pass "OPTION" to the assembler.

ARM-specific assembler options:
  -k                      generate PIC code
  -mthumb                 assemble Thumb code
  -mthumb-interwork       support ARM/Thumb interworking
  -mapcs-32               code uses 32-bit program counter
  -mapcs-26               code uses 26-bit program counter
  -mapcs-float            floating point args are in fp regs
  -mapcs-reentrant        re-entrant code
  -matpcs                 code is ATPCS conformant
  -mbig-endian            assemble for big-endian
  -mlittle-endian         assemble for little-endian
  -mapcs-frame            use frame pointer
  -mapcs-stack-check      use stack size checking
  -mno-warn-deprecated    do not warn on use of deprecated feature
  -mwarn-syms             warn about symbols that match instruction names [default]
  -mno-warn-syms          disable warnings about symobls that match instructions
  -mcpu=<cpu name>     assemble for CPU <cpu name>
  -march=<arch name>     assemble for architecture <arch name>
  -mfpu=<fpu name>     assemble for FPU architecture <fpu name>
  -mfloat-abi=<abi>     assemble for floating point ABI <abi>
  -meabi=<ver>        assemble for eabi version <ver>
  -mimplicit-it=<mode>     controls implicit insertion of IT instructions
  -mccs           TI CodeComposer Studio syntax compatibility mode
  -EB                     assemble code for a big-endian cpu
  -EL                     assemble code for a little-endian cpu
  --fix-v4bx              Allow BX in ARMv4 code
  --fdpic                 generate an FDPIC object file

Linker options
==============

Use "-Wl,OPTION" to pass "OPTION" to the linker.

armelf_linux_eabi:
  --thumb-entry=<sym>         Set the entry point to be Thumb symbol <sym>
  --be8                       Output BE8 format image
  --target1-rel               Interpret R_ARM_TARGET1 as R_ARM_REL32
  --target1-abs               Interpret R_ARM_TARGET1 as R_ARM_ABS32
  --target2=<type>            Specify definition of R_ARM_TARGET2
  --fix-v4bx                  Rewrite BX rn as MOV pc, rn for ARMv4
  --fix-v4bx-interworking     Rewrite BX rn branch to ARMv4 interworking veneer
  --use-blx                   Enable use of BLX instructions
  --vfp11-denorm-fix          Specify how to fix VFP11 denorm erratum
  --fix-stm32l4xx-629360      Specify how to fix STM32L4XX 629360 erratum
  --no-enum-size-warning      Don't warn about objects with incompatible
                                enum sizes
  --no-wchar-size-warning     Don't warn about objects with incompatible
                                wchar_t sizes
  --pic-veneer                Always generate PIC interworking veneers
  --long-plt                  Generate long .plt entries
                              to handle large .plt/.got displacements
  --cmse-implib               Make import library to be a secure gateway import
                                library as per ARMv8-M Security Extensions
  --in-implib                 Import library whose symbols address must
                                remain stable
  --stub-group-size=N         Maximum size of a group of input sections that
                                can be handled by one stub section.  A negative
                                value locates all stubs after their branches
                                (with a group size of -N), while a positive
                                value allows two groups of input sections, one
                                before, and one after each stub section.
                                Values of +/-1 indicate the linker should
                                choose suitable defaults.
  --[no-]fix-cortex-a8        Disable/enable Cortex-A8 Thumb-2 branch erratum fix
  --no-merge-exidx-entries    Disable merging exidx entries
  --[no-]fix-arm1176          Disable/enable ARM1176 BLX immediate erratum fix
armelfb_linux_eabi:
  --thumb-entry=<sym>         Set the entry point to be Thumb symbol <sym>
  --be8                       Output BE8 format image
  --target1-rel               Interpret R_ARM_TARGET1 as R_ARM_REL32
  --target1-abs               Interpret R_ARM_TARGET1 as R_ARM_ABS32
  --target2=<type>            Specify definition of R_ARM_TARGET2
  --fix-v4bx                  Rewrite BX rn as MOV pc, rn for ARMv4
  --fix-v4bx-interworking     Rewrite BX rn branch to ARMv4 interworking veneer
  --use-blx                   Enable use of BLX instructions
  --vfp11-denorm-fix          Specify how to fix VFP11 denorm erratum
  --fix-stm32l4xx-629360      Specify how to fix STM32L4XX 629360 erratum
  --no-enum-size-warning      Don't warn about objects with incompatible
                                enum sizes
  --no-wchar-size-warning     Don't warn about objects with incompatible
                                wchar_t sizes
  --pic-veneer                Always generate PIC interworking veneers
  --long-plt                  Generate long .plt entries
                              to handle large .plt/.got displacements
  --cmse-implib               Make import library to be a secure gateway import
                                library as per ARMv8-M Security Extensions
  --in-implib                 Import library whose symbols address must
                                remain stable
  --stub-group-size=N         Maximum size of a group of input sections that
                                can be handled by one stub section.  A negative
                                value locates all stubs after their branches
                                (with a group size of -N), while a positive
                                value allows two groups of input sections, one
                                before, and one after each stub section.
                                Values of +/-1 indicate the linker should
                                choose suitable defaults.
  --[no-]fix-cortex-a8        Disable/enable Cortex-A8 Thumb-2 branch erratum fix
  --no-merge-exidx-entries    Disable merging exidx entries
  --[no-]fix-arm1176          Disable/enable ARM1176 BLX immediate erratum fix


I'll be doing further research/testing this week and will post my findings here, thanks to everyone for contributing!


Top
 Profile  
 
 Post subject: Re: Raspberry PI Bare Bones OS
PostPosted: Sun May 30, 2021 3:18 pm 
Offline
Member
Member
User avatar

Joined: Fri Feb 17, 2017 4:01 pm
Posts: 640
Location: Ukraine, Bachmut
if gcc is so messy, byzantine and just f&cked up with this respect, maybe try clang as already suggested? for example, I got it on my Windows machine, messed around a bit with its (pretty sucky, admittedly) documentation and after a short time - was able to compile an aarch64 PE image of my UEFI OS Loader for ARM boards. and it worked just like the MSVC build. these two look like being crosscompilers by design and they let you compile/link even freestanding things pretty easy. ethin gave you a useful link. it's incomplete unfortunately, because, well lines like "target maybe A, B, C, etc" is not what one expects from a reference. should I guess, what that "etc" hides? :D if you don't like the idea of having a dozen of gcc builds for everything, and want to do your work on RPi, then your answer is clang.

_________________
ANT - NT-like OS for x64 and arm64.
efify - UEFI for a couple of boards (mips and arm). suspended due to lost of all the target park boards (russians destroyed our town).


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 36 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: DotBot [Bot], thewrongchristian and 79 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group