<feed xmlns='http://www.w3.org/2005/Atom'>
<title>opensbi.git/Makefile, branch v1.7</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<id>http://cgit.235523.xyz/opensbi.git/atom/Makefile?h=v1.7</id>
<link rel='self' href='http://cgit.235523.xyz/opensbi.git/atom/Makefile?h=v1.7'/>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/'/>
<updated>2025-06-15T12:58:55Z</updated>
<entry>
<title>Makefile: Add flag for reprodubility compiler flags</title>
<updated>2025-06-15T12:58:55Z</updated>
<author>
<name>Khem Raj</name>
<email>raj.khem@gmail.com</email>
</author>
<published>2025-05-15T02:59:31Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=6d23a9c5707de7243c0b3423724c0e4f3e1ee40d'/>
<id>urn:sha1:6d23a9c5707de7243c0b3423724c0e4f3e1ee40d</id>
<content type='text'>
Provides mechanism to remove absolute paths from binaries using
-ffile-prefix-map

It will help distros (e.g. yocto based ones ) which want to ship
the .elf files but need to scrub absolute paths in objects

Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
Signed-off-by: Khem Raj &lt;raj.khem@gmail.com&gt;
Link: https://lore.kernel.org/r/20250515025931.3383142-1-raj.khem@gmail.com
Signed-off-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>Makefile: Make $(LLVM) more flexible</title>
<updated>2025-06-14T04:41:11Z</updated>
<author>
<name>Charlie Jenkins</name>
<email>charlie@rivosinc.com</email>
</author>
<published>2025-04-30T23:38:31Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=27347f0902cdf69b20786726e3827df6df089b2a'/>
<id>urn:sha1:27347f0902cdf69b20786726e3827df6df089b2a</id>
<content type='text'>
Introduce a way for developers to easily switch between LLVM versions
with LLVM=/path/to/llvm/ and LLVM=-version. This is a useful
addition to the existing LLVM=1 variable which will select the first
clang and llvm binutils available on the path.

Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
Tested-by: Anup Patel &lt;anup@brainfault.org&gt;
Signed-off-by: Charlie Jenkins &lt;charlie@rivosinc.com&gt;
Link: https://lore.kernel.org/r/20250430-improve_llvm_building-v1-1-caae96cc6be6@rivosinc.com
Signed-off-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>Makefile: fix missing .debug_frame DWARF section for GCC</title>
<updated>2025-05-15T13:22:38Z</updated>
<author>
<name>Parshintsev Anatoly</name>
<email>anatoly.parshintsev@syntacore.com</email>
</author>
<published>2025-04-21T12:47:29Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=017a161788310ef515831821f14597e657512f97'/>
<id>urn:sha1:017a161788310ef515831821f14597e657512f97</id>
<content type='text'>
When OpenSBI is built with a relatively new compiler (gcc-13 and greater)
I observed that GDB is unable to produce proper backtraces and some
variable values appear corrupted (even if the associated DWARF
location descriptor is correct).

Turns out that to properly work with debug information, debuggers often
need to unwind the stack. They generally rely on Call Frame Information
(CFI) records provided by the compiler to facilitate this task.
Currently, the GCC compiler offers two mechanisms:

- `.debug_frame` section (as described in the DWARF specification).
- `.eh_frame` sections (as described in LSB documents).

The latter (`.eh_frame`) supports stack unwinding at runtime, providing
a framework for C++ exceptions or enabling backtrace generation using
libraries like libunwind. However, the downside of this approach is that
these sections should be part of loadable segments.

The former (`.debug_frame`) is simply an ordinary debug section.

Starting from GCC 13, Linux targets enable the `-fasynchronous-unwind-tables`
and `-funwind-tables` flags by default. Relevant commit:
https://github.com/gcc-mirror/gcc/commit/3cd08f7168

When these flags are active, the compiler generates `.eh_frame` sections
instead of `.debug_frame`. Since OpenSBI is built using the **Linux
toolchain**, this behavior applies to OpenSBI as well.

The problem arises because the SBI build system uses `-Wl,--gc-sections`,
which discards the `.eh_frame` section.

Possible Fixes:

1. Enforce `.debug_frame` generation – Modify compiler flags to generate
`.debug_frame` instead of `.eh_frame`.
2. Preserve `.eh_frame` in the linker script – Add `KEEP(*(.eh_frame))`
to ensure the section is not discarded.

I chose Option 1 because it avoids any runtime overhead.

Signed-off-by: Parshintsev Anatoly &lt;anatoly.parshintsev@syntacore.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
Link: https://lore.kernel.org/r/20250421124729.36364-1-anatoly.parshintsev@syntacore.com
Signed-off-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>Makefile: Avoid repeated evaluation of shell commands</title>
<updated>2025-04-13T16:19:14Z</updated>
<author>
<name>Samuel Holland</name>
<email>samuel.holland@sifive.com</email>
</author>
<published>2025-03-13T03:57:52Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=2142618f122b9f8052c5ad91d0ba3ef1a62fb9c2'/>
<id>urn:sha1:2142618f122b9f8052c5ad91d0ba3ef1a62fb9c2</id>
<content type='text'>
Recursively expanded variables (defined with '=') are expanded at
evaluation time. These version information variables are evaluated
inside a recipe as part of GENFLAGS. As a result, the shell commands
are executed separately for each compiler invocation. Convert the
version information variables to be simply expanded, so the shell
commands are executed only once, at Makefile evaluation time. This
speeds up the build by as much as 75%.

A separate check is needed to maintain the behavior of preferring the
value of OPENSBI_BUILD_TIME_STAMP from the environment.

Signed-off-by: Samuel Holland &lt;samuel.holland@sifive.com&gt;
Reviewed-by: Xiang W &lt;wxjstz@126.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
Link: https://lore.kernel.org/r/20250313035755.3796610-1-samuel.holland@sifive.com
Signed-off-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>lib: sbi: Avoid GOT indirection for global symbol references</title>
<updated>2025-03-24T11:30:59Z</updated>
<author>
<name>Samuel Holland</name>
<email>samuel.holland@sifive.com</email>
</author>
<published>2025-02-20T17:53:01Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=86c01a73ff9d34d21f7e7afca79315a411bfce15'/>
<id>urn:sha1:86c01a73ff9d34d21f7e7afca79315a411bfce15</id>
<content type='text'>
OpenSBI is compiled with -fPIE, which generally implies dynamic linking.
This causes the compiler to generate GOT references for global symbols
in order to support runtime symbol interposition. However, OpenSBI does
not actually perform dynamic linking, so the GOT indirection just adds
unnecessary overhead.

The GOT references can be avoided by declaring global symbols with
hidden visibility, thus making them local to this dynamic object and
non-interposable. GCC/Clang's -fvisibility parameter is insufficient for
this purpose when referencing objects from other translation units;
either __attribute__((visibility(...)) or the pragma is required. Use
the pragma since it is easier to apply to every symbol. Additionally
clean up the one GOT reference from inline assembly.

With this change, a firmware linked with LLD does not contain either a
GOT or a PLT, and a firmware linked with BFD ld contains only a GOT with
a single (unreferenced, legacy) _GLOBAL_OFFSET_TABLE_ entry.

Signed-off-by: Samuel Holland &lt;samuel.holland@sifive.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>Makefile: remove carry output if scripts/carray.sh fails</title>
<updated>2024-12-15T07:00:47Z</updated>
<author>
<name>Ben Dooks</name>
<email>ben.dooks@codethink.co.uk</email>
</author>
<published>2024-12-02T11:03:34Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=a36cd1b043d5f3f50fee43ab5b97754f6a8ec377'/>
<id>urn:sha1:a36cd1b043d5f3f50fee43ab5b97754f6a8ec377</id>
<content type='text'>
If the script fails, we end up trying to build either
an empty or damaged .c file. Just remove it and let
gcc fail on non-existent file.

Signed-off-by: Ben Dooks &lt;ben.dooks@codethink.co.uk&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>Makefile: Don't enable V-extension using -march option</title>
<updated>2024-12-15T06:00:48Z</updated>
<author>
<name>Anup Patel</name>
<email>apatel@ventanamicro.com</email>
</author>
<published>2024-12-09T14:36:18Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=5545602f778e3065674df3a630c67b820f5dc1da'/>
<id>urn:sha1:5545602f778e3065674df3a630c67b820f5dc1da</id>
<content type='text'>
Enabling V-extension using -march option causes OpenSBI boot-time
hang with LLVM compiler.

As a work-around, don't enable V-extension using -march option and
instead use a custom OpenSBI specific define inform availability of
V-extension to lib/sbi/sbi_trap_v_ldst.c.

Fixes: c2acc5e5b0d8 ("lib: sbi_misaligned_ldst: Add handling of vector load/store")
Signed-off-by: Anup Patel &lt;apatel@ventanamicro.com&gt;
Reviewed-by: Samuel Holland &lt;samuel.holland@sifive.com&gt;
</content>
</entry>
<entry>
<title>lib: sbi_misaligned_ldst: Add handling of vector load/store</title>
<updated>2024-12-06T12:13:06Z</updated>
<author>
<name>Nylon Chen</name>
<email>nylon.chen@sifive.com</email>
</author>
<published>2024-12-06T03:21:49Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=c2acc5e5b0d85166153032eaea181021c73e9752'/>
<id>urn:sha1:c2acc5e5b0d85166153032eaea181021c73e9752</id>
<content type='text'>
Add misaligned load/store handling for the vector extension
to the sbi_misaligned_ldst library.

This implementation is inspired from the misaligned_vec_ldst
implementation in the riscv-pk project.

Co-developed-by: Zong Li &lt;zong.li@sifive.com&gt;
Signed-off-by: Zong Li &lt;zong.li@sifive.com&gt;
Signed-off-by: Nylon Chen &lt;nylon.chen@sifive.com&gt;
Reviewed-by: Andy Chiu &lt;andy.chiu@sifive.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>Makefile: Fix POSIX grep for multiple patterns</title>
<updated>2024-12-01T07:02:18Z</updated>
<author>
<name>Igor Melnikov</name>
<email>imel@purelymail.com</email>
</author>
<published>2024-11-28T22:15:02Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=40e725da031ccdcc76492a7677e418ee5f6ef013'/>
<id>urn:sha1:40e725da031ccdcc76492a7677e418ee5f6ef013</id>
<content type='text'>
grep -e "-mstrict-align\|-mno-unaligned-access" makes use of GNU grep's
backslash-escaped alternation operator \| which is available in basic
regular expression syntax (BRE) mode.

However, in POSIX grep's BRE mode | is an ordinary character which, when
backslash-escaped, matches itself. Therefore, the search pattern becomes
a plain string '-mstrict-align|-mno-unaligned-access' which obviously
never matches the expected error and CC_SUPPORT_STRICT_ALIGN is always set
to y.

When cross-compiling with LLVM on amd64-unknown-openbsd7.6 host for
riscv64-unknown-elf target this results in a compilation error:

clang: error: unsupported option '-mno-unaligned-access' for target
'riscv64-unknown-elf'

Using multiple -e options for this case maintains consistent behaviour
across different grep implementations and fixes the issue.

Signed-off-by: Igor Melnikov &lt;imel@purelymail.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>Makefile: enable --gc-sections</title>
<updated>2024-11-06T10:59:39Z</updated>
<author>
<name>Kele Zhang</name>
<email>zhangcola2003@gmail.com</email>
</author>
<published>2024-10-01T23:05:51Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=0171cfcc7010bcd75277a2c452e9702d934230f9'/>
<id>urn:sha1:0171cfcc7010bcd75277a2c452e9702d934230f9</id>
<content type='text'>
The --gc-sections option enables the linker to perform garbage
collection of unreferenced code and data, thereby reducing the binary
size.

The -ffunction-sections option will place each function into a separate
section, so it is necessary to add .text.* to the linker script.

Signed-off-by: Kele Zhang &lt;zhangcola2003@gmail.com&gt;
Signed-off-by: Yuan Tan &lt;tanyuan@tinylab.org&gt;
Signed-off-by: Zhangjin Wu &lt;falcon@tinylab.org&gt;
Reviewed-by: Bin Meng &lt;bmeng.cn@gmail.com&gt;
Reviewed-by: Xiang W &lt;wxjstz@126.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
</feed>
