Commit graph

132 commits

Author SHA1 Message Date
Pirama Arumuga Nainar
c6fa2c3925 Merge "Make versioner depend on lib{LLVM,clang}_android.so" 2017-11-09 21:59:54 +00:00
Josh Gao
8e13b67c64 versioner: properly handle extern "C", "C++".
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
2017-11-06 17:23:36 -08:00
Pirama Arumuga Nainar
ac5603a979 Make versioner depend on lib{LLVM,clang}_android.so
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
2017-11-06 11:26:57 -08:00
Sergii Piatakov
564ed96caf tools: fix error when /bin/sh isn't bash
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>
2017-11-02 20:41:59 +02:00
Josh Gao
ab25d0bd10 versioner: compile headers in both C and C++ mode.
Bug: https://github.com/android-ndk/ndk/issues/440
Test: python run_tests.py
Change-Id: Ib572a8fdcc00f6b88a25003a085b16ce9698d692
2017-10-30 12:47:24 -07:00
Josh Gao
38685e1887 versioner: follow __asm__ labels.
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
2017-10-30 12:47:24 -07:00
Josh Gao
35aa21352e versioner: kill some obsolete versions.
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
2017-10-24 17:51:25 -07:00
Josh Gao
0062b3e60a versioner: properly handle declarations with no identifier.
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
2017-10-24 17:51:06 -07:00
Josh Gao
5317f2d48b versioner: add extern "C" to tests.
Bug: https://github.com/android-ndk/ndk/issues/440
Test: python run_tests.py
Change-Id: Id893979146bc609a17bd1fa2a6bec6f10dfe4804
2017-10-24 16:02:25 -07:00
Chih-Hung Hsieh
84f0dcd59e Use -Werror in bionic
Bug: 66996870
Test: build with WITH_TIDY=1
Change-Id: Ic68141a5c50880c485646e38349f94b866267bd9
2017-10-02 13:21:22 -07:00
Elliott Hughes
b3639adf9c Merge changes I76dde1e3,I54fec461
* changes:
  Add <sys/random.h>.
  Run other maintenance scripts as part of the preupload hooks.
2017-09-29 15:39:29 +00:00
Elliott Hughes
9651093569 Run other maintenance scripts as part of the preupload hooks.
And get back up to date by actually running them...

Bug: N/A
Test: uploaded this
Change-Id: I54fec461190e8570929fdcbcbf2746ddd6a4b293
2017-09-28 22:28:23 -07:00
Dan Willemsen
7ebc81f4a2 Fix error found building relocation packer for host bionic
bionic/tools/relocation_packer/src/main.cc:109:7: error: comparison of constant
-1 with expression of type 'typeof (read(fd.get(), e_ident, (16)) != (16))'
(aka 'bool') is always false [-Werror,-Wtautological-constant-out-of-range-compare]

  if (TEMP_FAILURE_RETRY(read(fd.get(), e_ident, EI_NIDENT) != EI_NIDENT)) {
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

bionic/libc/include/unistd.h:243:18: note: expanded from macro 'TEMP_FAILURE_RETRY'
    } while (_rc == -1 && errno == EINTR); \
             ~~~ ^  ~~
1 error generated.

Bug: 31559095
Test: mmma bionic
Change-Id: I473a19e3d51ff355233ae7f87b1013be069edb1f
2017-09-22 19:37:35 +00:00
Treehugger Robot
ad5c4e3596 Merge "Fix out-of-bounds deque access causing build failure." 2017-08-18 01:55:39 +00:00
Andreas Huber
113e9b1bc1 Fix out-of-bounds deque access causing build failure.
Bug: http://b/64802958
Test: built successfully

Change-Id: I8029826f0e4c7f578155d7db545e7786c76a0cdf
2017-08-17 22:26:20 +00:00
George Burgess IV
1de2e358ca Enable FORTIFY in unoptimized builds
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
2017-08-15 21:20:09 -07:00
Treehugger Robot
1db06faa38 Merge "libc: Split FORTIFY into its own headers" 2017-08-01 02:03:52 +00:00
Treehugger Robot
b1bbf2bb24 Merge "versioner: compile with clang -include foo.h -." 2017-07-29 16:36:33 +00:00
Josh Gao
d2ab9ffcb6 versioner: compile with clang -include foo.h -.
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
2017-07-28 12:57:16 -07:00
George Burgess IV
b97049c039 libc: Split FORTIFY into its own headers
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
2017-07-27 17:00:13 -07:00
dimitry
0acb63aaa6 Properly handle elf-files without relocation sections
Relocation packer no longer complains about missing
relocation sections.

Test: relocation-packer-unit-tests
Test: mm
Change-Id: I56814be326c15e046db1a96d14568d951f689ae2
2017-07-11 17:00:09 +02:00
Treehugger Robot
05fd20c797 Merge changes Ia7200bf0,I86999bb7
* changes:
  versioner: fix leak.
  versioner: add symlink for dependencies.
2017-05-04 04:08:22 +00:00
Andreas Gampe
d10d3eece1 versioner: disable container overflow checks
Temporary workaround.

Bug: 37775238
Test: ASAN_OPTIONS= SANITIZE_HOST=address m
Change-Id: If9e9df45d83f8412caafcece87337a5c9df3a1c8
2017-05-01 16:31:51 -07:00
Josh Gao
b50b8c8886 versioner: fix leak.
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
2017-04-27 17:25:32 -07:00
Josh Gao
0be1dabfc6 versioner: add symlink for dependencies.
Add a symlink where dependencies used to live, so that `versioner`
works.

Test: versioner
Test: tools/versioner/run_tests.py
Change-Id: I86999bb79baad16039709306591cb9540fb533ca
2017-04-27 17:25:23 -07:00
Yi Kong
06be3459ca Update bionic after Clang rebase
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
2017-04-26 10:44:12 -07:00
Yi Kong
ff6c8de4f5 Remove unused lambda captures
Clean up. This fixes build under -Wunused-lambda-capture.

Test: build
Change-Id: Ic12aa39e14ed55dbb28cf55303f9c4258179037d
2017-04-20 14:37:56 -07:00
Treehugger Robot
a07033e0dc Merge "versioner: fix LLVM assertion failure." 2017-04-06 23:35:52 +00:00
Josh Gao
8ef9874d56 versioner: fix LLVM assertion failure.
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
2017-04-06 13:37:56 -07:00
Josh Gao
acc7921580 versioner: remove useless log message.
Test: tools/versioner/run_tests.py
Change-Id: I70edafb7ad6a6274e7daa508903520dbb4b399c8
2017-04-03 12:41:35 -07:00
Josh Gao
d744a9bcd5 versioner: fix indentation in usage.
Test: versioner -h
Change-Id: I96cba65e53c564c8f47714c74d300e8f3dee7e82
2017-04-03 12:41:35 -07:00
Josh Gao
3fcf747f1d versioner: guard preprocessing messages with -v.
Bug: http://b/36751878
Test: tools/versioner/run_tests.py
Change-Id: I5142a33519b101548ccaec8a3bc498e446a648a7
2017-04-03 12:41:35 -07:00
Dan Albert
69cb22f4d7 Build the versioner even on unbundled branches.
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
2017-03-27 13:28:27 -07:00
Dan Albert
22805ea9b8 Revert "Revert "Run the versioner as part of the build.""
This reverts commit 69c7562f59.

Test: make checkbuild
Change-Id: Ie443029398c01b45e0a0317a8074808b064f35d4
2017-03-27 13:06:45 -07:00
Josh Gao
b8a3ae4bcb versioner: fix darwin build.
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
2017-02-23 13:52:49 -08:00
Josh Gao
0a284f5c05 versioner: start using C++17.
Bug: None
Test: python run_tests.py
Change-Id: I10101d26b7816a83445f25b33b97ed47d42fd135
2016-12-15 13:56:00 -08:00
Colin Cross
68d6a9288a Convert versioner to Android.bp
See build/soong/README.md for more information.

Test: mma -j
Change-Id: I0e648143ac480c1257d9829f9b9087ee22005855
2016-12-15 10:44:41 -08:00
Josh Gao
cdbf6fe94f versioner: use unique_ptr to handle ownership of FTS*.
Bug: None
Test: python run_tests.py
Change-Id: I510063e9b57afda4f5492198cd40c15fc6380d2d
2016-11-29 08:28:49 -08:00
Josh Gao
9f9200c2ee Merge "versioner: extract strict warnings out of -v into its own flag." 2016-11-22 00:51:14 +00:00
Josh Gao
2796894c98 Merge "versioner: use a single work queue." 2016-11-22 00:50:59 +00:00
Josh Gao
acc3d80edf versioner: extract strict warnings out of -v into its own flag.
Bug: None
Test: versioner -v; versioner -s
Change-Id: I8f6ac7064c6f05de0811677f7fcfce929a2568c1
2016-11-17 18:12:21 -08:00
Josh Gao
338cf12963 versioner: use a single work queue.
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
2016-11-17 18:11:57 -08:00
Josh Gao
3091f5a06e versioner: ignore non-header files.
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
2016-11-16 17:01:57 -08:00
Treehugger Robot
b3321c9614 Merge changes I72d37b7c,I7d254a10,I2e967acf
* changes:
  versioner: use a virtual filesystem for input files.
  versioner: cache -cc1 flags generated by the clang Driver.
  versioner: refactor to use CompilerInstance directly.
2016-11-15 00:54:09 +00:00
Josh Gao
78b8a1430d versioner: use a virtual filesystem for input files.
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
2016-11-09 18:12:10 -08:00
Josh Gao
b5c496346f versioner: cache -cc1 flags generated by the clang Driver.
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
2016-11-09 18:10:15 -08:00
Josh Gao
16016df79f versioner: refactor to use CompilerInstance directly.
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
2016-11-09 13:50:07 -08:00
Treehugger Robot
84e269d5af Merge "versioner: don't always hide future decls." 2016-11-09 02:07:17 +00:00
Josh Gao
9ae2b9a521 versioner: don't always hide future decls.
Bug: http://b/32748732
Test: python run_tests.py
Change-Id: I8f799015ebb1017f5e7d1324fb4c724e12a268bc
2016-11-08 16:28:07 -08:00
Treehugger Robot
147fdb4724 Merge "Clean up update_headers.sh." 2016-11-05 20:09:12 +00:00