extern "C" and "C++" are parsed as a LinkageSpecDecl with the real Decl
as a child node. This leads to the preprocessor sticking its guard
between the extern specifier and the declaration.
Update the AST visitor to add a special-case for calculating the
SourceRange on a LinkageSpecDecl, and add a test.
Bug: https://github.com/android-ndk/ndk/issues/440
Test: python run_tests.py
Change-Id: I76445fe366cef46cfd2f16fb93d534d410c5edca
Bug: http://b/64121881
The modules built in the Android tree are now named
lib{LLVM,clang}_android.so. Let versioner depend on these temporarily
before eventually depending on the prebuilt libraries.
Test: aosp_marlin checkbuild with FORCE_BUILD_LLVM_COMPONENTS set and
unset.
Change-Id: I4e04dd2c74a19e0918f81bac04c1daee63ed6b24
The following scripts use `bash` specific variable `${BASH_SOURCE[0]}`
so this doesn't work correct in case when `/bin/sh` isn't `bash`.
Test: repo upload bionic
Change-Id: I12ce0666f9404107dceb03960bad4ec11b14ba2d
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
Attribute the versioning information on `void foo() __asm("bar")` to
bar, not foo.
The various long double functions in <math.h> run into this.
Bug: https://github.com/android-ndk/ndk/issues/440
Test: python run_tests.py
Test: m
Change-Id: Idd3681ddbd006b4705608449935c9cfacfa3556e
Make the selection of a non-default API level non-fatal, so that we
won't have to continually fix all of the tests every time we remove an
API version.
Test: versioner
Test: python run_tests.py
Change-Id: I96429584e352f7e012c5129da3c02dc1b4b30061
Some declarations, like bitfield members, don't need identifiers.
Bug: https://github.com/android-ndk/ndk/issues/440
Test: ran versioner with -x c++ on a manually reduced <linux/timex.h>
Change-Id: Ic7eea780762cff653c54fdde4d10df203d630c25
GCC's FORTIFY required optimizations to be enabled in order to function
properly. Clang's FORTIFY doesn't have this limitation, so it seems
pointless to keep it disabled due to a GCC-specific limitation.
Bug: 12231437
Test: Checkbuild on bullhead internal master + CtsBionicTestCases. No
new failures.
Change-Id: I74aa35f9d3f3d2a6b11a7adfe72a787e3d7f7f36
At least one warning only triggers in files that are included, instead
of being passed directly. Switch to compiling with -include, and fix
the resulting warnings.
Bug: https://github.com/android-ndk/ndk/issues/474
Test: mma -j && versioner
Test: python tools/versioner/run_tests.py
Change-Id: I784698c18540c9cc30f372f279a1cec1d75721ea
This patch cleans up our standard headers by moving most of the FORTIFY
cruft out in to its own sandbox. In order to include the *_chk and
*_real declarations, you can either enable FORTIFY, or `#define
__BIONIC_DECLARE_FORTIFY_HELPERS`.
Both sys/select.h and strings.h are explicitly ignored by this patch.
Both of these files have very small __BIONIC_FORTIFY blocks, and don't
define any actual FORTIFY'ed functions (just macros, and 3 *_chk
functions).
This patch also makes the versioner ignore the FORTIFY implementation
headers, since we're guaranteed to pick the FORTIFY'ed headers up when
looking at the regular headers. (...Not to mention that making the
FORTIFY'ed headers freestanding would be annoying to do and maintain for
~no benefit).
We bake the knowledge of where FORTIFY headers live directly into the
versioner. We could go with a more general approach (e.g. adding an -X
IGNORED_FILE flag that tells the versioner to ignore
$HEADER_PATH/$IGNORED_FILE), but we'd then have to repeat that for every
test, every manual invocation of the versioner, etc. for no benefit
that's obvious to me.
Bug: 12231437
Test: m checkbuild on bullhead internal master + CtsBionicTestCases. no
new errors.
Change-Id: Iffc0cc609009b33d989cdaddde0a809282131a5b
Relocation packer no longer complains about missing
relocation sections.
Test: relocation-packer-unit-tests
Test: mm
Change-Id: I56814be326c15e046db1a96d14568d951f689ae2
Replace an intentional leak of a buffer allocated by realpath with a use
of android::base::Realpath.
Bug: http://b/37727515
Test: tools/versioner/run_tests.py
Change-Id: Ia7200bf0e1c485050e860e21ff15784941366bec
Add a symlink where dependencies used to live, so that `versioner`
works.
Test: versioner
Test: tools/versioner/run_tests.py
Change-Id: I86999bb79baad16039709306591cb9540fb533ca
After the new rebase of Clang, we now supports alloc_size attribute, so
we can remove the warning about switching to alloc_size once Clang has
support.
Compiler.setInvocation has changed argument type from raw pointer to
shared pointer. Add version check here so that we can build under either
old rebase or the new rebase.
Test: build
Bug: 37423073
Change-Id: I4563eaf93bae6c59a4a19318f8caa92bd361b3ab
MemoryBuffer::getOpenFileSlice asserts that the map size passed in
isn't -1 (presumably because the offset can be nonzero). Switch to
getOpenFile, which results in an identical call to the implementation
function without the assert.
Bug: http://b/37002637
Test: export FORCE_BUILD_LLVM_COMPONENTS=true
export FORCE_BUILD_LLVM_DEBUG=true
export FORCE_BUILD_LLVM_DISABLE_NDEBUG=true
mma -j && versioner
Change-Id: Ib610db9e07429aa3f64128eaef6ef555c4d1868e
This is needed to generate the NDK, so unbundled projects using the
NDK need to build this. If they don't need the NDK, they should just
remove bionic from their manifest.
Test: make checkbuild
Bug: None
Change-Id: I7db816c4a341cf34d4d11739dc64182af630ad63
Use struct stat::st_mtime instead of the underlying st_mtim, which is
called something different on Darwin.
Test: mma on linux, darwin
Change-Id: I2695a6c83ebb7d08ec56b1355e0f4bc0993a0acb
Previously, each thread was assigned a fixed list of work, and the main
thread would block until every thread was finished, leading to most
cores sitting idle for the last few hundred milliseconds while a few
particularly long running threads would keep working. Use a single work
queue to evenly distribute load across the threads.
Bug: http://b/32748936
Test: python run_tests.py
Change-Id: I80e231ece3b95e2721a32f658905841b89a8dc3b
Don't try to compile non-headers (vim swap files, etc.) that happen to
be in the header directory.
Bug: none
Test: manually created a file in libc/include
Change-Id: I2c1647ec7174dc617898dc2f07c9a80a08b69c72
* changes:
versioner: use a virtual filesystem for input files.
versioner: cache -cc1 flags generated by the clang Driver.
versioner: refactor to use CompilerInstance directly.
Use an InMemoryFileSystem to store and share input files across
compilations.
This improves the result of `time versioner` further, from:
versioner 109.12s user 17.43s system 2433% cpu 5.201 total
to:
versioner 112.20s user 1.38s system 2416% cpu 4.700 total
Bug: http://b/32748936
Test: python run_tests.py
Change-Id: I72d37b7c30850b8399cc40338247700fe3e7b2f9
Profiling showed that majority of time spent by versioner was being
spent in the x86 and x86_64 driver statting random files in /usr/lib,
looking for a toolchain. Hardcode a list of per-target flags which
correspond to a subset of the ones generated by clang, and use those
instead of calling out to Driver.
This changes the result of `time versioner` from:
versioner 156.57s user 1180.08s system 4109% cpu 32.525 total
to:
versioner 109.12s user 17.43s system 2433% cpu 5.201 total
Bug: http://b/32748936
Test: python run_tests.py
Change-Id: I7d254a105bf1a283cbba0546321b04e308e703d1
This will make it easier to switch over to a virtual filesystem,
which should drastically improve performance.
This also fixes an issue with warning/error reporting.
Bug: http://b/32748936
Test: python run_tests.py
Change-Id: I2e967acf75db29c95f3a03f4f94cccd22c367ad5
Clean up some output, check for errors from the versioner.
Test: tools/update_headers.sh
Bug: None
Change-Id: Ib398b534a9a8ee6dc6a2b4d90747f628aa911bab
Regenerating the NOTICE file the other day left me scratching my head at
various "how do they differ?" cases, resolved by this patch.
Test: N/A
Change-Id: I4230bfa1d7ec842a4b9fb8c73dd3b39443d74054
Generate a single NOTICE file rather than one per library. All the
headers come from libc these days anyway.
Test: tools/update_notice.sh
Bug: None
Change-Id: I127da185fdabc2815042e19aea74c507ec108f46
Also updates the license files, since apparently they're out of date.
Test: repo upload --cbr .
Bug: None
Change-Id: Ic8d855a7ee5185c4933da699292868e02ef79531
Poking around with -Wundef exposed a pretty horrifying bug, so we
should probably keep it turned on.
Bug: http://b/31496165
Change-Id: Iada279eec91ded0d59ff3841d5a3ce1a36e34c3a
Add an attribute that tells the preprocessor not to guard a
declaration, primarily for use with symbols that get reexported by
libc++ of the form `namespace std { using ::wctrans; }`.
Bug: http://b/28178111
Change-Id: I08c8751214797e37e8f26e7f7416a19e81c2bb4c
Compile headers with both -D_FILE_OFFSET_BITS=32 and -D_FILE_OFFSET_BITS=64.
Bug: http://b/30170081
Change-Id: I92651e075cc69bdc1a2581f99892c9a7fdcdb35b
Test: python run_tests.py
This was causing redundant guards to be emitted in cases where
declarations were already guarded by another macro.
Bug: http://b/30170081
Change-Id: I9080838fbea5a56225df4b26d0918657fb6c4f21
Test: python run_tests.py
Make sure everything works with relative/absolute paths, and with and
without trailing slashes.
Bug: http://b/30170081
Change-Id: Ia13a8ae2fa44590e835d0f4b006d4c31e9eaea83
Test: python run_tests.py
Move the Android.mk to src/ so that mm in that directory works.
Also, remove the dependency on FORCE_BUILD_LLVM_COMPONENTS.
Change-Id: Iad7f3fc96f5f26f9535141d752ba865b40d5ff7e
Zero initialize the contents of ArchMap, keep track of the symbol name
in Declaration, remove unnecessary copies in loops.
Change-Id: I47b07755846f252b83ffc4c89547a34b2f7ab868
Major refactor to use __attribute__((annotate)) to be able to keep
track of the semantic differences between __INTRODUCED_IN(x) and
__INTRODUCED_IN_X86(x), for use in the upcoming preprocessor.
Bug: http://b/30170081
Change-Id: I6496a8c40ba7f4553de9a2be0bbddcf37c813937
The target was moved by commit 5956b4e, but none of the headers
contained were actually necessary to compile any bionic headers.
Bug: http://b/30170081
Change-Id: I8c1a7464de0992c20af194340c0e36d131a836e7
The android-only kernel headers were moved to their own directory by
commit d6e8b8c. Add a new symlink to match.
Change-Id: I06ce7c3167fbb1e058e4a137fae9375bb5792a46
Some of the error messages emitted by versioner (the ones where it was
invoked incorrectly) go to stderr, which meant that the test runner
ignored them. Merge stdout and stderr, and switch from testing for
exact equality to endswith, because of the compilation errors test.
Change-Id: I0e2c25bcc9dea4c12ea82a6a05b29e561a61a902
Git doesn't track empty directories, so most of the tests would fail on
a fresh checkout because of dependencies/common being missing. Remove
the use of dependencies from all of the non-dependency related tests.
Change-Id: I09cc5765aae1576914c1c5d7dfa3fb666eab4a3f
Search for the header/dependency/platform directories in a hard-coded
path relative to $ANDROID_BUILD_TOP when they're not specified.
Change-Id: I476385cfc0247e3b2009348ec37c1810a0e9a7f7
Add a clang-based tool to inspect header availability attributes and
verify them against the NDK platform definitions.
Bug: http://b/28178111
Change-Id: I1bb1925a620e98cc9606cb5a3360b1224c700bd0
This time with more namespace qualification.
Tested manually by building clang_x64/android_relocation_packer locally,
as the Android trybot analyze step does not think it needs to run for
this change.
Original description:
> The code was essentially doing 'using Logger::INFO' in the global
> namespace to make its 'LOG(INFO)' macros work. Unfortunately, C++ does
> not allow you to use using decls on classes like this unless you are in
> a derived class. GCC does not accept this code, and Clang was recently
> updated (LLVM r268594) to reject it as well.
>
> This should fix the Chromium Android ASan build with TOT Clang:
> https://build.chromium.org/p/chromium.fyi/builders/ClangToTAndroidASan/TBR=thakis@chromium.org,sgurun@chromium.org
BUG=609543
Review-Url: https://codereview.chromium.org/1952353005
Cr-Commit-Position: refs/heads/master@{#391952}
(cherry picked from commit 5762af8ad13e62957493c3e4314a234ee57a4200)
Change-Id: Ibc6f6023aef028c5029be128ac799dc67fc6683c
Turn messages that are printed on every run of relocation_packer down to
VLOG(1) to clean up ninja build output.
Bug: 24409581
Change-Id: I040aed6a7b4261eefa6f7278fa451180115b0716
On unpacking, reinstate any p_align values that packing reduced to
page size. Ensures a round-trip pack and unpack is bit-equivalent
to the original input.
https://android-review.googlesource.com/#/c/148492/
Extend unit tests to include ia32, x64, and mips32.
Recreate test data for arm32 and arm64. Generate new test data for
ia32, x64, and mips32.
Bug: http://b/20687795
Bug: http://b/18051137
Change-Id: Ifbca8e206ef447297ba4f19272b813702be27a35