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

Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
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
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
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
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
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
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 

Recently uploaded (20)

Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
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...
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
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
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
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!
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 

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