summaryrefslogtreecommitdiffstats
path: root/clang/test/Driver/constructors.c
Commit message (Collapse)AuthorAgeFilesLines
* [Driver] Use .init_array for all gcc installations and simplify Generic_ELF ↵Fangrui Song2019-12-131-1/+1
| | | | | | | | | | | | | | | | | -fno-use-init-array rules D39317 made clang use .init_array when no gcc installations is found. This change changes all gcc installations to use .init_array . GCC 4.7 by default stopped providing .ctors/.dtors compatible crt files, and stopped emitting .ctors for __attribute__((constructor)). .init_array should always work. FreeBSD rules are moved to FreeBSD.cpp to make Generic_ELF rules clean. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D71434
* Default to -fuse-init-arrayFangrui Song2019-12-121-2/+2
| | | | | | | | | | | | | | | | | | | Very few ELF platforms still use .ctors/.dtors now. Linux (glibc: 1999-07), DragonFlyBSD, FreeBSD (2012-03) and Solaris have supported .init_array for many years. Some architectures like AArch64/RISC-V default to .init_array . GNU ld and gold can even convert .ctors to .init_array . It makes more sense to flip the CC1 default, and only uses -fno-use-init-array on platforms that don't support .init_array . For example, OpenBSD did not support DT_INIT_ARRAY before Aug 2016 (https://github.com/openbsd/src/commit/86fa57a2792c6374b0849dd7b818a11e676e60ba) I may miss some ELF platforms that still use .ctors, but their maintainers can easily diagnose such problems. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D71393
* Request init/fini array on FreeBSD 12 and laterDimitry Andric2018-06-291-0/+8
| | | | | | | | | | | | | | | | | | | | | | | Summary: It seems a bad idea to change the default in the middle of a release branch due to possible changes in global ctor / dtor ordering between .ctors and .init_array. With FreeBSD 11.0's release imminent lets change the default now for FreeBSD 12 (the current development stream) and later. FreeBSD rtld has supported .init_array / .fini_array for many years. As of Jan 1 2017 all supported FreeBSD releases and branches will have support. Reviewers: dim, brooks, arichardson Reviewed By: dim, brooks, arichardson Subscribers: bsdjhb, krytarowski, emaste, cfe-commits Differential Revision: https://reviews.llvm.org/D24867 llvm-svn: 336008
* Use -fuse-init-array if no gcc installation is found.Nico Weber2017-10-261-0/+6
| | | | | | | | | | | | | | | | clang currently uses .init_array instead of .ctors on Linux if it detects gcc 4.7+. Make it so that it also uses .init_array if no gcc installation is found at all – if there's no old gcc, there's nothing we need to be compatible with. icecc for example runs clang in a very small chroot, so before this change clang would use .ctors if run under icecc. And lld currently silently mislinks inputs with .ctors sections, so before this clang + icecc + lld would produce broken binaries. (But this seems like a good change independent of that lld bug.) https://reviews.llvm.org/D39317 llvm-svn: 316713
* Unconditionally use .init_array instead of .ctors on Solaris.Aaron Ballman2017-07-141-0/+8
| | | | | | Patch by Fedor Sergeev llvm-svn: 308038
* Fix clash of gcc toolchains in driver regression tests.Samuel Antao2015-01-051-0/+10
| | | | | | For some regression tests the path to the right toolchain is specified using the -sysroot switch. However, if clang was configured with a custom gcc toolchain (either by using GCC_INSTALL_PREFIX in cmake or the equivalent configure command), the path to the custom gcc toolchain path takes precedence to the one specified by sysroot. This causes several regression tests to fail as they will be using an unexpected path. This patch fixes this issue by adding --gcc-toolchain='' to all tests that rely on that. The empty string causes the driver to pick the path from sysroot instead. llvm-svn: 225182
* [ARM64] Add ARM64 RUN lines to a bunch of tests that had AARCH64 RUN lines.James Molloy2014-04-171-0/+9
| | | | | | | This covers all tests in tests/Driver and tests/Preprocessor, but there are some failing tests in test/Sema that need looking into. llvm-svn: 206464
* Enable -fuse-init-array for all AArch64 ELF targets by default, not just linux.Kristof Beyls2014-01-101-0/+9
| | | | llvm-svn: 198940
* Fix the '-fuse-init-array' option to actually be an option.Chandler Carruth2012-11-211-15/+33
| | | | | | | | | | | | | | | | | | Previously, this flag to CC1 was never exposed at the clang driver layer, and if you happened to enable it (by being on Android or GCC 4.7 platform), you couldn't *disable* it, because there was no 'no' variant. The whole thing was confusingly implemented. Now, the target-specific flag processing gets the driver arg list, and we use standard hasFlag with a default based on the GCC version and/or Android platform. The user can still pass the 'no-' variant to forcibly disable the flag, or pass the positive variant to clang itself to enable the flag. The test has also been substantially cleaned up and extended to cover these use cases. llvm-svn: 168473
* Enable -fuse-init-array for Android X86/MIPS.Logan Chien2012-11-191-1/+17
| | | | | | | | | | | | The dynamic linker of Android does not support .ctors/.dtors. We should emit .init_array and .fini_array regardless the gcc version. NOTE: This patch does not affect the ARM backend, because it is required to generate .init_array and .fini_array for program targeting ARM AAPCS and AEABI. llvm-svn: 168309
* Add a -fuse-init-array option to cc1 and map to the UseInitArray targetRafael Espindola2012-06-191-0/+14
option. On the driver, check if we are using libraries from gcc 4.7 or newer and if so pass -fuse-init-array to the frontend. The crtbegin*.o files in gcc 4.7 no longer call the constructors listed in .ctors, so we have to use .init_array. llvm-svn: 158694
OpenPOWER on IntegriCloud