LLVM

8-bit Character support on architectures were the smallest addressable unit size is 64-bit in Clang and LLVM

8-bit characters in VIAMPP
D.llvm
Thomas Pietsch
<p>Clang and LLVM have a great history of supporting a great variety of CPUs, from 8- to 64-bits assuming they all have a smallest size of an addressable unit of 8-bits words. Despite the fact that a lot of types and there alignment can be defined with the “target datalayout” string, the “character” and “short” type have been hard-coded into clang and llvm.</p>
Clang and LLVM have a great history of supporting a great variety of CPUs, from 8- to 64-bits assuming they all have a smallest size of an addressable unit of 8-bits words. Despite the fact that a lot of types and there alignment can be defined with the “target datalayout” string, the “character” and “short” type have been hard-coded into clang and llvm. Once you compile with clang you will get for example: @.str = private unnamed_addr constant [6 x i8] c"Hallo\00", align 8 Some proposals exist to that offer a solutions to this problem (e.g. FOSDEM 2012: “Adding 16-bit Character Support in LLVM” or https://lists.llvm.org/pipermail/llvm-dev/2019-May/132080.html: “On removing magic numbers assuming 8-bit bytes”). Following this ideas one has to apply changes to over 120 files (clang and llvm v12.0.0) and keeping a patch set nearly impossible. Looking for simpler solution for this problem we explored a couple of alternative solutions. Two design goals have to be satisfied: don’t change CHAR_BIT keep CharWidth at 8-bits Only the modification of the character alignment to 64-bits is allowed. With modifying only 8 files (some of them only dealing with character assertions) we end up with the desired result of: @.str = private unnamed_addr constant [6 x i64] [i64 72, i64 97, i64 108, i64 108, i64 111, i64 0], align 8 This solutions can also easily be adopted to machines with a minimal addressable unit of 16- or 32-bits. Also “WChar” can be addressed with minimal changes. As this is solution is still under testing, the amount of files changed might be further reduced, and should allow for a small and simple patch set.

Additional information

Type devroom

More sessions

2/5/22
LLVM
D.llvm
<p>The aim of this abstract is to showcase the enhanced debuggability support added in LLVM for the Fortran language features. LLVM being emerging compiler framework, there was some gap to be bridged w.r.t. Fortran language debug info generation. This is because Fortran language has few features which are very powerful, as compared to other languages.</p> <p>Fortran dynamic arrays are one such powerful language feature. There are variety of arrays like adjustable array, assumed shape, assumed ...
2/5/22
LLVM
Pavel Kosov
D.llvm
<p>In this talk we will briefly describe how to add your own extension to C, what steps may be needed to do it. And then we will review a small example</p>
2/5/22
LLVM
Leonardo Di Donato
D.llvm
<p>eBPF is fastly becoming the first choice for implementing tracing and security-critical applications and software.</p> <p>Yet, its ecosystem lacks tooling to make developers' life easier.</p> <p>Join this talk to get to know bpfcov: an open-source tool I wrote that uses the LLVM pass infrastructure to instrument your eBPF programs to collect coverage data while they run in the eBPF VM in the Linux kernel.</p>
2/5/22
LLVM
Kristof Beyls
D.llvm
<p>Compilers play a crucial role in hardening software against security attacks. As compiler engineers we experience an increase in demand for security-related features: we simply work on security-related features more often. We find it tough to analyze whether the hardenings we implement are easy or hard to circumvent by attackers. After chatting about this with many compiler developers, our experience is that most feel their work would benefit from a deeper understanding of attacks and ...
2/5/22
LLVM
Bernhard Rosenkränzer
D.llvm
<p>Oniro - the Eclipse Foundation's embedded operating system - is switching from libstdc++ to libc++ by default. This talk gives an overview of our experience daring to make the switch.</p>
2/5/22
LLVM
Babar Khan
D.llvm
<p>Although Linux is still the best preferred operating system, the talk begins with a problem statement regarding the dependencies of ANTLR and LLVM on Windows. To this end, the presenter will explain how these dependency issues can be resolved through an easy-to-use environment for building, installing and running native LLVM and ANTLR on Windows. Furthermore, the talk will briefly explain how we can design domain specific languages (DSLs) using a powerful combination of ANTLR and LLVM front ...