Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: clang/llvm on aarch64



On 8/28/19, Michał Górny <mgorny%gentoo.org@localhost> wrote:
>On Wed, 2019-08-28 at 14:23 +0100, Robert Swindells wrote:
>> On 8/28/19, Michał Górny <mgorny%gentoo.org@localhost> wrote:
>> > On Wed, 2019-08-28 at 02:40 +0100, Robert Swindells wrote:
>> > > I wrote:
>> > > > It looks like clang++ on aarch64 is broken too, but in a different way.
>> > > > 
>> > > > Static constructors don't get called. I do have a small test application
>> > > > that demonstrates this.
>> > > 
>> > > This looks to be caused by clang/llvm putting the references to the
>> > > constructor in the .ctors section instead of the .init_array section as
>> > > required by the ABI.
>> > > 
>> > > There is code in clang to select this and a web search turns up some
>> > > patches from 2014 to enable it for all AARCH64 ELF platforms but the
>> > > source tree seems to have changed a lot since then.
>> > 
>> > I see the following for Generic_ELF thingy:
>> > 
>> >  if (DriverArgs.hasFlag(options::OPT_fuse_init_array,
>> >                         options::OPT_fno_use_init_array, UseInitArrayDefault))
>> >    CC1Args.push_back("-fuse-init-array");
>> > 
>> > NetBSD should be using that.  Could you verify with 'clang -v' whether
>> > it's being passed to cc1?
>> 
>> % clang -v
>> clang version 8.0.1 (tags/RELEASE_801/final)
>> Target: aarch64-unknown-netbsd9.99
>> Thread model: posix
>> InstalledDir: /usr/pkg/bin
>
>I'm sorry for not being precise.  I meant compiling and linking
>an actual program with '-v' (== verbose).

% clang++ -v -O2 -c bad1.cpp
clang version 8.0.1 (tags/RELEASE_801/final)
Target: aarch64-unknown-netbsd9.99
Thread model: posix
InstalledDir: /usr/pkg/bin
 "/usr/pkg/bin/clang-8" -cc1 -triple aarch64-unknown-netbsd9.99 -emit-obj -disable-free -disable-llvm-verifier -discard-value-names -main-file-name bad1.cpp -mrelocation-model static -mthread-model posix -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu generic -target-feature +neon -target-abi aapcs -fallow-half-arguments-and-returns -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -v -coverage-notes-file /home/rjs/clang/bad1.gcno -resource-dir /usr/pkg/lib/clang/8.0.1 -internal-isystem /usr/include/g++ -internal-isystem /usr/include/g++/ -internal-isystem /usr/include/g++/backward -O2 -fdeprecated-macro -fdebug-compilation-dir /home/rjs/clang -ferror-limit 19 -fmessage-length 80 -fno-signed-char -fobjc-runtime=gnustep -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o bad1.o -x c++ bad1.cpp
clang -cc1 version 8.0.1 based upon LLVM 8.0.1 default target aarch64-unknown-netbsd9.99
ignoring duplicate directory "/usr/include/g++"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++
 /usr/include/g++/backward
 /usr/pkg/lib/clang/8.0.1/include
 /usr/include
End of search list.

% clang++ -v -o bad badmain.o bad1.o
clang version 8.0.1 (tags/RELEASE_801/final)
Target: aarch64-unknown-netbsd9.99
Thread model: posix
InstalledDir: /usr/pkg/bin
 "/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld.elf_so -o bad /usr/lib/crt0.o /usr/lib/crti.o /usr/lib/crtbegin.o badmain.o bad1.o -lstdc++ -lm -lc /usr/lib/crtend.o /usr/lib/crtn.o



Home | Main Index | Thread Index | Old Index