SlideShare a Scribd company logo
1 of 11
Download to read offline
Wed-5-Mar, 11:15am, Presenter Name.
LCA14-304: Building Android with
CLANG for ARMv7 & v8 platforms
lWorking much closer with upstream than before: Of a fairly large patchset touching 62
subprojects, only 18 patched subprojects remain. All other patches (including partial
patches to subprojects we're still patching) have been upstreamed.
lCurrent status: gcc 4.9 based builds on Nexus 10 and Nexus 7 (2013) are working
perfectly. Clang 3.4 based builds compile, but don't currently boot because of a Bionic
problem that needs further analysis.
lRemaining subprojects we have to apply local patches to:
lart, dalvik
lelfutils, e2fsprogs, perf, iproute2, llvm, libunwind
lbionic
lGallery2
lhardware/qcom/display, hardware/samsung_slsi/exynos5
lframeworks/av, frameworks/base
lexternal/chromium, external/chromium_org
lsystem/core
lkernel
Current status
lart
lclang 3.4 extra warnings that cause the build (with enforced -Werror) to fail:
lImplicitly casting enums to int
lMissing template keyword gcc is less strict about
lInitialized but unused variable
ldalvik
lUse of __builtin___clear_cache (gcc extension)
Remaining issues
lelfutils
lheavy use of nested functions (a gcc extension not supported in clang; clang
maintainers say they will never support it)
lTriggers clang bug #18201
lProblem with upstreaming: AOSP wants patches to elfutils to go through the elfutils
project rather than AOSP. elfutils maintainers don't care, calling any compiler other
than gcc “useless crap”
le2fsprogs
lProblems caused by clang using C99 semantics while gcc defaults to C89 semantics
– different interpretations of “inline”, “extern inline”
lFix accepted in upstream e2fsprogs
lAOSP should pull in updated e2fsprogs; patch doing that submitted but not yet
accepted (stuck in review loop?)
lperf
lRelies on __thread being available
liproute2
lUses variable-length arrays in structs (gcc extension not supported by clang)
Remaining issues
lllvm
lProbably the oddest thing not to compile with clang out of the box, given clang is part
of the llvm project...
lBut Bionic is at fault – with extra safety checks enabled, Bionic uses
l#define sprintf __builtin___sprintf_chk
lllvm uses std::sprintf...
lSo the patch is a workaround for an underlying Bionic issue
lGallery2
lCaused by different inline semantics (gcc defaulting to C89, clang to C99)
Remaining issues
lbionic
lBootup issues caused by blobs being built incorrectly: A number of blobs (e.g. GPU drivers for Nexus 10, Nexus 7) are
built with ancient toolchains, and rely on availability of libgcc symbols being exported by something (Android doesn't
have a shared libgcc). Proper fix is to fix (or better, open) blobs
lBionic has some hacks to provide what they need:
l#define COMPAT_FUNCTIONS_LIST 
l XX(__adddf3) ...
l#define XX(f) extern void f(void);
lCOMPAT_FUNCTIONS_LIST
l#undef XX
l#define XX(f) f();
lvoid __bionic_libgcc_compat_hooks(void)
l{
l COMPAT_FUNCTIONS_LIST
l}
lWith gcc 4.9, that workaround is needed for some extra functions - __aeabi_udivmod and __popcount_tab
lClang issues:
lClang generates infinite recursive calls if __aeabi_memcpy and friends are implemented the Bionic way:
lvoid __aeabi_memcpy(void *dest, const void *src, size_t n) {
lmemcpy(dest, src, n); }
lRemaining (yet unsolved) issue: Applications including init crash on startup when using a clang 3.4-compiled Bionic.
Remaining issues
lHardware/qcom/display
lSingleton instances declared outside their target namespace. Produces a warning in clang 3.4 (C++11 extension used
outside of C++11 mode), causing build failure because of -Werror
lHardware/samsumg_slsi/exynos5
lUse of constructs that can be interpreted as C++11 string literals. Causes warnings with gcc 4.9
lFrameworks/av
lInline assembly incompatible with clang (“add r8, r0, asl #2” rather than “add r8, r8, r0, asl #2”)
lUndefined static const variables (kicked out by gcc -O1 and higher, problem with clang and gcc -O0)
lMissing #include statement for DISALLOW_EVIL_CONSTRUCTORS
lFrameworks/base
lUses variable-length arrays of non-POD data types – gcc extension not supported by clanalng
lExternal/chromium, external/chromium_org
lUse of std::snprintf (Bionic's default implementation is a #define)
lAssumptions about clang being clang 3.3
lUpstreaming slower because it has to go through 3rd party (chromium.org)
lSystem/core
lC99 inline semantics
Remaining issues
lKernel
lThe upstream kernel has various issues with clang 3.4, most of which are being fixed these days.
lBiggest issue is the use of variable-length arrays in structs (there is code to replace them – but gcc so far seems to
generate better code with VLAIS than with portable replacement constructs).
lVarious bugs discovered in device specific code that isn't part of the upstream kernel (e.g. incorrect uses of sizeof in
various Nexus 7 specific bits)
Remaining issues
lClang-wrapper (tool we're using to give clang a more gcc-like interface, so we don't
have to modify the build system) has complete Aarch64 support
lBoth gcc 4.9 and clang 3.4 have good Aarch64 support
lHowever, not all of the Android codebase is ready for the 64bit world – complete
64/64 build is still a work in progress regardless of toolchain.
Aarch64 status
lAarch64 porting
lRun test builds with clang 3.5 snapshots
lUpstream remaining patches
Next steps
More about Linaro Connect: http://connect.linaro.org
More about Linaro: http://www.linaro.org/about/
More about Linaro engineering: http://www.linaro.org/engineering/
Linaro members: www.linaro.org/members

More Related Content

More from Linaro

Intelligent Interconnect Architecture to Enable Next Generation HPC - Linaro ...
Intelligent Interconnect Architecture to Enable Next Generation HPC - Linaro ...Intelligent Interconnect Architecture to Enable Next Generation HPC - Linaro ...
Intelligent Interconnect Architecture to Enable Next Generation HPC - Linaro ...Linaro
 
Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...
Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...
Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...Linaro
 
Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...
Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...
Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...Linaro
 
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainlineHKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainlineLinaro
 
HKG18-100K1 - George Grey: Opening Keynote
HKG18-100K1 - George Grey: Opening KeynoteHKG18-100K1 - George Grey: Opening Keynote
HKG18-100K1 - George Grey: Opening KeynoteLinaro
 
HKG18-318 - OpenAMP Workshop
HKG18-318 - OpenAMP WorkshopHKG18-318 - OpenAMP Workshop
HKG18-318 - OpenAMP WorkshopLinaro
 
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainlineHKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainlineLinaro
 
HKG18-315 - Why the ecosystem is a wonderful thing, warts and all
HKG18-315 - Why the ecosystem is a wonderful thing, warts and allHKG18-315 - Why the ecosystem is a wonderful thing, warts and all
HKG18-315 - Why the ecosystem is a wonderful thing, warts and allLinaro
 
HKG18- 115 - Partitioning ARM Systems with the Jailhouse Hypervisor
HKG18- 115 - Partitioning ARM Systems with the Jailhouse HypervisorHKG18- 115 - Partitioning ARM Systems with the Jailhouse Hypervisor
HKG18- 115 - Partitioning ARM Systems with the Jailhouse HypervisorLinaro
 
HKG18-TR08 - Upstreaming SVE in QEMU
HKG18-TR08 - Upstreaming SVE in QEMUHKG18-TR08 - Upstreaming SVE in QEMU
HKG18-TR08 - Upstreaming SVE in QEMULinaro
 
HKG18-113- Secure Data Path work with i.MX8M
HKG18-113- Secure Data Path work with i.MX8MHKG18-113- Secure Data Path work with i.MX8M
HKG18-113- Secure Data Path work with i.MX8MLinaro
 
HKG18-120 - Devicetree Schema Documentation and Validation
HKG18-120 - Devicetree Schema Documentation and Validation HKG18-120 - Devicetree Schema Documentation and Validation
HKG18-120 - Devicetree Schema Documentation and Validation Linaro
 
HKG18-223 - Trusted FirmwareM: Trusted boot
HKG18-223 - Trusted FirmwareM: Trusted bootHKG18-223 - Trusted FirmwareM: Trusted boot
HKG18-223 - Trusted FirmwareM: Trusted bootLinaro
 
HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...
HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...
HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...Linaro
 
HKG18-317 - Arm Server Ready Program
HKG18-317 - Arm Server Ready ProgramHKG18-317 - Arm Server Ready Program
HKG18-317 - Arm Server Ready ProgramLinaro
 
HKG18-312 - CMSIS-NN
HKG18-312 - CMSIS-NNHKG18-312 - CMSIS-NN
HKG18-312 - CMSIS-NNLinaro
 
HKG18-301 - Dramatically Accelerate 96Board Software via an FPGA with Integra...
HKG18-301 - Dramatically Accelerate 96Board Software via an FPGA with Integra...HKG18-301 - Dramatically Accelerate 96Board Software via an FPGA with Integra...
HKG18-301 - Dramatically Accelerate 96Board Software via an FPGA with Integra...Linaro
 
HKG18-300K2 - Keynote: Tomas Evensen - All Programmable SoCs? – Platforms to ...
HKG18-300K2 - Keynote: Tomas Evensen - All Programmable SoCs? – Platforms to ...HKG18-300K2 - Keynote: Tomas Evensen - All Programmable SoCs? – Platforms to ...
HKG18-300K2 - Keynote: Tomas Evensen - All Programmable SoCs? – Platforms to ...Linaro
 
HKG18-212 - Trusted Firmware M: Introduction
HKG18-212 - Trusted Firmware M: IntroductionHKG18-212 - Trusted Firmware M: Introduction
HKG18-212 - Trusted Firmware M: IntroductionLinaro
 
HKG18-116 - RAS Solutions for Arm64 Servers
HKG18-116 - RAS Solutions for Arm64 ServersHKG18-116 - RAS Solutions for Arm64 Servers
HKG18-116 - RAS Solutions for Arm64 ServersLinaro
 

More from Linaro (20)

Intelligent Interconnect Architecture to Enable Next Generation HPC - Linaro ...
Intelligent Interconnect Architecture to Enable Next Generation HPC - Linaro ...Intelligent Interconnect Architecture to Enable Next Generation HPC - Linaro ...
Intelligent Interconnect Architecture to Enable Next Generation HPC - Linaro ...
 
Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...
Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...
Yutaka Ishikawa - Post-K and Arm HPC Ecosystem - Linaro Arm HPC Workshop Sant...
 
Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...
Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...
Andrew J Younge - Vanguard Astra - Petascale Arm Platform for U.S. DOE/ASC Su...
 
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainlineHKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
 
HKG18-100K1 - George Grey: Opening Keynote
HKG18-100K1 - George Grey: Opening KeynoteHKG18-100K1 - George Grey: Opening Keynote
HKG18-100K1 - George Grey: Opening Keynote
 
HKG18-318 - OpenAMP Workshop
HKG18-318 - OpenAMP WorkshopHKG18-318 - OpenAMP Workshop
HKG18-318 - OpenAMP Workshop
 
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainlineHKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
HKG18-501 - EAS on Common Kernel 4.14 and getting (much) closer to mainline
 
HKG18-315 - Why the ecosystem is a wonderful thing, warts and all
HKG18-315 - Why the ecosystem is a wonderful thing, warts and allHKG18-315 - Why the ecosystem is a wonderful thing, warts and all
HKG18-315 - Why the ecosystem is a wonderful thing, warts and all
 
HKG18- 115 - Partitioning ARM Systems with the Jailhouse Hypervisor
HKG18- 115 - Partitioning ARM Systems with the Jailhouse HypervisorHKG18- 115 - Partitioning ARM Systems with the Jailhouse Hypervisor
HKG18- 115 - Partitioning ARM Systems with the Jailhouse Hypervisor
 
HKG18-TR08 - Upstreaming SVE in QEMU
HKG18-TR08 - Upstreaming SVE in QEMUHKG18-TR08 - Upstreaming SVE in QEMU
HKG18-TR08 - Upstreaming SVE in QEMU
 
HKG18-113- Secure Data Path work with i.MX8M
HKG18-113- Secure Data Path work with i.MX8MHKG18-113- Secure Data Path work with i.MX8M
HKG18-113- Secure Data Path work with i.MX8M
 
HKG18-120 - Devicetree Schema Documentation and Validation
HKG18-120 - Devicetree Schema Documentation and Validation HKG18-120 - Devicetree Schema Documentation and Validation
HKG18-120 - Devicetree Schema Documentation and Validation
 
HKG18-223 - Trusted FirmwareM: Trusted boot
HKG18-223 - Trusted FirmwareM: Trusted bootHKG18-223 - Trusted FirmwareM: Trusted boot
HKG18-223 - Trusted FirmwareM: Trusted boot
 
HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...
HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...
HKG18-500K1 - Keynote: Dileep Bhandarkar - Emerging Computing Trends in the D...
 
HKG18-317 - Arm Server Ready Program
HKG18-317 - Arm Server Ready ProgramHKG18-317 - Arm Server Ready Program
HKG18-317 - Arm Server Ready Program
 
HKG18-312 - CMSIS-NN
HKG18-312 - CMSIS-NNHKG18-312 - CMSIS-NN
HKG18-312 - CMSIS-NN
 
HKG18-301 - Dramatically Accelerate 96Board Software via an FPGA with Integra...
HKG18-301 - Dramatically Accelerate 96Board Software via an FPGA with Integra...HKG18-301 - Dramatically Accelerate 96Board Software via an FPGA with Integra...
HKG18-301 - Dramatically Accelerate 96Board Software via an FPGA with Integra...
 
HKG18-300K2 - Keynote: Tomas Evensen - All Programmable SoCs? – Platforms to ...
HKG18-300K2 - Keynote: Tomas Evensen - All Programmable SoCs? – Platforms to ...HKG18-300K2 - Keynote: Tomas Evensen - All Programmable SoCs? – Platforms to ...
HKG18-300K2 - Keynote: Tomas Evensen - All Programmable SoCs? – Platforms to ...
 
HKG18-212 - Trusted Firmware M: Introduction
HKG18-212 - Trusted Firmware M: IntroductionHKG18-212 - Trusted Firmware M: Introduction
HKG18-212 - Trusted Firmware M: Introduction
 
HKG18-116 - RAS Solutions for Arm64 Servers
HKG18-116 - RAS Solutions for Arm64 ServersHKG18-116 - RAS Solutions for Arm64 Servers
HKG18-116 - RAS Solutions for Arm64 Servers
 

Recently uploaded

WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 

Recently uploaded (20)

WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 

LCA14: LCA14-304: Building Android with CLANG for ARM v7 and v8 platforms

  • 1. Wed-5-Mar, 11:15am, Presenter Name. LCA14-304: Building Android with CLANG for ARMv7 & v8 platforms
  • 2. lWorking much closer with upstream than before: Of a fairly large patchset touching 62 subprojects, only 18 patched subprojects remain. All other patches (including partial patches to subprojects we're still patching) have been upstreamed. lCurrent status: gcc 4.9 based builds on Nexus 10 and Nexus 7 (2013) are working perfectly. Clang 3.4 based builds compile, but don't currently boot because of a Bionic problem that needs further analysis. lRemaining subprojects we have to apply local patches to: lart, dalvik lelfutils, e2fsprogs, perf, iproute2, llvm, libunwind lbionic lGallery2 lhardware/qcom/display, hardware/samsung_slsi/exynos5 lframeworks/av, frameworks/base lexternal/chromium, external/chromium_org lsystem/core lkernel Current status
  • 3. lart lclang 3.4 extra warnings that cause the build (with enforced -Werror) to fail: lImplicitly casting enums to int lMissing template keyword gcc is less strict about lInitialized but unused variable ldalvik lUse of __builtin___clear_cache (gcc extension) Remaining issues
  • 4. lelfutils lheavy use of nested functions (a gcc extension not supported in clang; clang maintainers say they will never support it) lTriggers clang bug #18201 lProblem with upstreaming: AOSP wants patches to elfutils to go through the elfutils project rather than AOSP. elfutils maintainers don't care, calling any compiler other than gcc “useless crap” le2fsprogs lProblems caused by clang using C99 semantics while gcc defaults to C89 semantics – different interpretations of “inline”, “extern inline” lFix accepted in upstream e2fsprogs lAOSP should pull in updated e2fsprogs; patch doing that submitted but not yet accepted (stuck in review loop?) lperf lRelies on __thread being available liproute2 lUses variable-length arrays in structs (gcc extension not supported by clang) Remaining issues
  • 5. lllvm lProbably the oddest thing not to compile with clang out of the box, given clang is part of the llvm project... lBut Bionic is at fault – with extra safety checks enabled, Bionic uses l#define sprintf __builtin___sprintf_chk lllvm uses std::sprintf... lSo the patch is a workaround for an underlying Bionic issue lGallery2 lCaused by different inline semantics (gcc defaulting to C89, clang to C99) Remaining issues
  • 6. lbionic lBootup issues caused by blobs being built incorrectly: A number of blobs (e.g. GPU drivers for Nexus 10, Nexus 7) are built with ancient toolchains, and rely on availability of libgcc symbols being exported by something (Android doesn't have a shared libgcc). Proper fix is to fix (or better, open) blobs lBionic has some hacks to provide what they need: l#define COMPAT_FUNCTIONS_LIST l XX(__adddf3) ... l#define XX(f) extern void f(void); lCOMPAT_FUNCTIONS_LIST l#undef XX l#define XX(f) f(); lvoid __bionic_libgcc_compat_hooks(void) l{ l COMPAT_FUNCTIONS_LIST l} lWith gcc 4.9, that workaround is needed for some extra functions - __aeabi_udivmod and __popcount_tab lClang issues: lClang generates infinite recursive calls if __aeabi_memcpy and friends are implemented the Bionic way: lvoid __aeabi_memcpy(void *dest, const void *src, size_t n) { lmemcpy(dest, src, n); } lRemaining (yet unsolved) issue: Applications including init crash on startup when using a clang 3.4-compiled Bionic. Remaining issues
  • 7. lHardware/qcom/display lSingleton instances declared outside their target namespace. Produces a warning in clang 3.4 (C++11 extension used outside of C++11 mode), causing build failure because of -Werror lHardware/samsumg_slsi/exynos5 lUse of constructs that can be interpreted as C++11 string literals. Causes warnings with gcc 4.9 lFrameworks/av lInline assembly incompatible with clang (“add r8, r0, asl #2” rather than “add r8, r8, r0, asl #2”) lUndefined static const variables (kicked out by gcc -O1 and higher, problem with clang and gcc -O0) lMissing #include statement for DISALLOW_EVIL_CONSTRUCTORS lFrameworks/base lUses variable-length arrays of non-POD data types – gcc extension not supported by clanalng lExternal/chromium, external/chromium_org lUse of std::snprintf (Bionic's default implementation is a #define) lAssumptions about clang being clang 3.3 lUpstreaming slower because it has to go through 3rd party (chromium.org) lSystem/core lC99 inline semantics Remaining issues
  • 8. lKernel lThe upstream kernel has various issues with clang 3.4, most of which are being fixed these days. lBiggest issue is the use of variable-length arrays in structs (there is code to replace them – but gcc so far seems to generate better code with VLAIS than with portable replacement constructs). lVarious bugs discovered in device specific code that isn't part of the upstream kernel (e.g. incorrect uses of sizeof in various Nexus 7 specific bits) Remaining issues
  • 9. lClang-wrapper (tool we're using to give clang a more gcc-like interface, so we don't have to modify the build system) has complete Aarch64 support lBoth gcc 4.9 and clang 3.4 have good Aarch64 support lHowever, not all of the Android codebase is ready for the 64bit world – complete 64/64 build is still a work in progress regardless of toolchain. Aarch64 status
  • 10. lAarch64 porting lRun test builds with clang 3.5 snapshots lUpstream remaining patches Next steps
  • 11. More about Linaro Connect: http://connect.linaro.org More about Linaro: http://www.linaro.org/about/ More about Linaro engineering: http://www.linaro.org/engineering/ Linaro members: www.linaro.org/members