Commit graph

108 commits

Author SHA1 Message Date
Pirama Arumuga Nainar
5514287dc3 [versioner] Use libclang-cpp.so
Bug: http://b/150809112

This is a new upstream library that exports both the clang and LLVM C++
symbols and can replace libLLVM and (android-toolchain-only)
libclang_cxx.so.

Test: Build and run versioner
Change-Id: Ib711c29f478e00e39f26dd09917618b349f0c786
2021-12-01 03:15:30 -08:00
Elliott Hughes
6b586e7709 Force everything to use python3 for consistency.
Rather than "whatever people have installed as 'python' on their machine".

I've removed check-symbols.py because that's been broken for years and
we never even noticed, and I'm not sure it's worth fixing.

Test: treehugger, manual
Change-Id: Ieb996bbdf790a18d4b1fb46a409cc240ba2a2a49
2021-04-15 13:39:08 -07:00
Bob Badour
aa7d835fdd Add LOCAL_LICENSE_KINDS to bionic
Added SPDX-license-identifier-Apache-2.0 to:
  apex/Android.bp
  libdl/Android.bp
  tools/Android.bp
  tools/versioner/Android.bp
  tools/versioner/src/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  benchmarks/Android.bp
  benchmarks/linker_relocation/gen/Android.bp
  libc/malloc_debug/Android.bp
  libc/system_properties/Android.bp
  tests/Android.bp
  tests/libs/Android.bp
  tests/libs/Android.build.dlext_testzip.mk
  tests/make_fortify_compile_test.mk

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-ISC SPDX-license-identifier-MIT
    legacy_notice legacy_unencumbered
to:
  libc/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-MIT legacy_unencumbered
to:
  libm/Android.bp

Added SPDX-license-identifier-Apache-2.0 legacy_unencumbered
to:
  libc/tools/Android.bp

Added SPDX-license-identifier-BSD
to:
  benchmarks/linker_relocation/Android.bp
  benchmarks/spawn/Android.bp
  libc/async_safe/Android.bp
  libc/malloc_hooks/Android.bp
  libfdtrack/Android.bp
  linker/Android.bp
  tests/headers/Android.bp
  tests/headers/posix/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all
Exempt-From-Owner-Approval: janitorial work
Change-Id: Ib05bcaa276b3aa71a7654ccbe8e67e1f16aec9f3
2021-02-19 23:38:28 +00:00
Elliott Hughes
5e44c22ebf Revert "[LSC] Add LOCAL_LICENSE_KINDS to bionic"
This reverts commit 48d43034d7.

Reason for revert: bionic is multiple projects, not just one.

Change-Id: Ib31e1bb8888cc85c6e7736c4e2a1d4652fd23935
2021-02-16 20:02:47 +00:00
Bob Badour
48d43034d7 [LSC] Add LOCAL_LICENSE_KINDS to bionic
Added SPDX-license-identifier-Apache-2.0 to:
  libdl/Android.bp
  tools/versioner/src/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  benchmarks/Android.bp
  libc/malloc_debug/Android.bp
  libc/system_properties/Android.bp
  linker/Android.bp
  tests/Android.bp
  tests/libs/Android.bp
  tests/libs/Android.build.dlext_testzip.mk
  tests/make_fortify_compile_test.mk

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-ISC SPDX-license-identifier-MIT
    legacy_notice legacy_unencumbered
to:
  Android.bp
  libc/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-ISC SPDX-license-identifier-MIT
    legacy_unencumbered
to:
  tools/Android.bp
  tools/versioner/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-MIT legacy_unencumbered
to:
  libm/Android.bp

Added SPDX-license-identifier-Apache-2.0 legacy_unencumbered
to:
  libc/tools/Android.bp

Added SPDX-license-identifier-BSD
to:
  benchmarks/linker_relocation/Android.bp
  benchmarks/spawn/Android.bp
  libc/async_safe/Android.bp
  libc/malloc_hooks/Android.bp
  libfdtrack/Android.bp
  tests/headers/Android.bp
  tests/headers/posix/Android.bp

Added legacy_notice
to:
  apex/Android.bp
  benchmarks/linker_relocation/gen/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: I76cad00578b9b99180ee5dd1e04b4646d5c5fedf
2021-02-12 17:51:24 -08:00
Yabin Cui
1169bf9cf3 Fix versioner for clang update.
Bug: 171348143
Test: build versioner.
Change-Id: I7432bdba6b021fcfa22207a186978e0ca336c4cb
2021-01-07 15:58:54 -08:00
Stephen Hines
760647791f Adapt for update to clang-r399163.
This is really just a case of including the proper header for a
function.

Bug: http://b/155835175
Test: OUT_DIR=out prebuilts/clang-tools/build-prebuilts.sh
Change-Id: I0523d3ccd8cb502e8c2b8f72f137db4b60fb1dac
2020-09-22 13:37:42 -07:00
Elliott Hughes
c2c9b420bd Cleanup for #inclusivefixit.
Not sure how this one got missed earlier.

Test: treehugger
Change-Id: Ia4e6f62a3d33d3ac01e3d7db836caadeed0ff63b
Bug: 161896447
2020-07-30 21:19:45 +00:00
Elliott Hughes
68ae6ad12e Changes for #inclusivefixit.
Test: treehugger
Change-Id: I7ff0496c5c2792a41781e74634247f55b0548213
2020-07-21 16:34:58 -07:00
Elliott Hughes
8c936b4e6c Use more inclusive language.
One turns out not to be used at all, and the pylintrc even uses the more
intention-revealing term in the machine readable part, just not the
comment!

Test: treehugger
Change-Id: I4db7f1cf4fa1aa8ee601857e4e4c400e2119887c
2020-06-15 11:18:43 -07:00
Stephen Hines
25b8af496c Adapt to clang-r383902
This change adapts versioner to llvm::StringRef losing its implicit
conversion to std::string().

Test: ./build-prebuilts.sh
Change-Id: Ie1b290cf12e7044a92545470ce4f968cc55d90c9
2020-05-01 03:44:40 -07:00
Elliott Hughes
5ac438e5da Clean up mips references in the headers.
Test: treehugger
Change-Id: I1997af980b9e46c7c530f9e6cb1aa407b2d63d76
2020-02-13 18:00:16 -08:00
Elliott Hughes
5f1165c66f versioner: don't require mips headers.
If we remove the mips uapi headers, versioner fails because it assumes
they're available. We'll need a new versioner prebuilt beforre we can
remove the libc/versioner-dependencies/mips* symlinks.

Test: treehugger
Change-Id: Ife6df0cb57938f806a31ec334d648df9694c3d17
2020-01-30 14:35:01 -08:00
Logan Chien
c88331b062 versioner: Add versioner_fortify_inline annotation
This commit adds versioner_fortify_inline annotation.  This annotation
indicates that the annotated function is an overloaded inline function
for _FORTIFY_SOURCE implementation.  They are usually enabled/disabled
by the enable_if attribute, thus the versioner don't have to check
whether they have conflicting definitions.

Bug: 118991081
Test: source development/vndk/tools/header-checker/android/envsetup.sh && \
      source build/envsetup.sh && \
      lunch aosp_arm64-userdebug && \
      m versioner && \
      ./bionic/tools/versioner/run_tests.py
Change-Id: If5c739fc0c8a218907855939c1fe5338134da7f7
2019-12-23 07:22:48 -08:00
Logan Chien
a6bf7f2ee3 versioner: Add a built-in macro for conditional compilation
This commit adds a built-in macro for conditional compilation because
__attribute__((annotate(...))) may pull unused static inline functions
into object files.

We must not generate those functions in object files because it can
result in undefined references to __strchr_chk on linux_glibc.

Bug: 118991081
Test: source development/vndk/tools/header-checker/android/envsetup.sh && \
      source build/envsetup.sh && \
      lunch aosp_arm64-userdebug && \
      m versioner && \
      ./bionic/tools/versioner/run_tests.py
Change-Id: I0c9d967413ec8e8655e91316973a79b81e2129b1
2019-12-23 07:14:05 -08:00
Logan Chien
1da9f96463 versioner: Migrate to clang-r370808
Bug: 139945549
Test: lunch aosp_arm64-userdebug && \
      m versioner && \
      PATH=out/host/linux-x86/bin:$PATH \
      ./bionic/tools/versioner/run_tests.py

Change-Id: I1a548de9d1ce82aee30144a359e215a4daf5fc2b
2019-12-05 14:03:05 -08:00
Elliott Hughes
f7db8507ee Restore _FORTIFY_SOURCE in versioner.
Bug: http://b/118991081
Test: treehugger
Change-Id: I2818d8c27ecc5a48666013cdd0eaa26ec7900688
2019-11-06 14:35:34 -08:00
Logan Chien
8fd8b99978 versioner: Add R to codename map
This commit adds "R" to codename map because `libc.map.txt` started
using "introduced=R".

Test: PATH=prebuilts/clang-tools/linux-x86/bin:$PATH \
      ./bionic/tools/versioner/run_tests.py
Bug: 140110040

Change-Id: Ibc1154557c29d9580b5c527160116b24fa4c656f
2019-08-27 11:54:28 -07:00
Logan Chien
c071fe4089 versioner: Update clang prebuilts to clang-r365631
This commit ports bionic version to clang-r365631.
`clang::CompilerInstance::setVirtualFileSystem(VFS)` has been replaced
by `clang::CompilerInstance::createFileManager(VFS)`.

Test: OUT_DIR=out ./prebuilts/clang-tools/build-prebuilts.sh
Bug: 140110040
Change-Id: Ia833d502765dd9885eb85026d513bdfdee3756f3
2019-08-27 09:53:53 -07:00
Yi Kong
358603a409 Modernise code to use override specifier
Generated by clang-tidy.

Test: m checkbuild
Change-Id: I8e23da6b8af31b291be2eefe9937ca222ea8a8c3
2019-03-29 14:27:27 -07:00
Elliott Hughes
5270017ab3 Remove __INTRODUCED_IN_FUTURE.
This hasn't been particularly useful, we haven't used it consistently,
and it has caused trouble.

Test: builds
Change-Id: Ic5b5b5124af98aa8301e602fd75b0eb72a5fc7f6
2019-03-14 13:34:21 -07:00
Chih-hung Hsieh
f42616d765 Revert "Work around bugprone-exception-escape bug."
This reverts commit 153b71c407.

Reason for revert: fixed in clang-r346389
Bug: 117120485
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=bugprone-*

Change-Id: I49971e4227d6d5772efccd551d493a0f1e68416a
2018-12-04 23:51:44 +00:00
Logan Chien
aef762aee1 versioner: Use llvm::opt::ArgStringList
This commit replaces `clang::driver::ArgStringList` with
`llvm::opt::ArgStringList` because starting from r344398, the alias for
`llvm::opt::ArgStringList` has been removed from the `clang::driver`
namespace.

Note: This is a step to port clang tools to clang-r346389.

See also. https://reviews.llvm.org/rL344398

Bug: 119558057
Test: cd bionic/tools/versioner; mma; ./run_tests.py
Change-Id: I9b5ff572a9af6c6ffaf2c4c9cb01c97f4b85ac22
2018-12-04 17:20:22 +08:00
Elliott Hughes
9a9db3444f C++17 is the default now.
Test: builds
Change-Id: I283ae69a69da95f20ee924885321677c6d5f4429
2018-12-03 09:29:36 -08:00
Logan Chien
6c148d17e5 versioner: Port to clang-r344140
This commit updates bionic versioner to use clang-r344140.  To be
specific, this commit renames `clang::vfs::FileSystem` to
`llvm::vfs::FileSystem` and updates the headers.

Bug: 111759196
Test: bionic/tools/versioner/run_tests.py
Change-Id: I304ecae79da5a1638ae755dac92b52e314019cf1
2018-11-07 10:35:38 +08:00
Logan Chien
c16d65d70e versioner: Port to clang-r339409b
This commit ports versions to clang-r339409b and utilizes
`libclang-cxx.so`.

Bug: 113263746
Test: ./bionic/tools/versioner/run_tests.py
Change-Id: Ib104a6c8c2c69df51cfa2760dbca125f4cfa054b
2018-10-31 14:53:30 +08:00
Logan Chien
9c123230e2 versioner: Build SymbolDatabase from version scripts
This commit adds a version script parser so that versioner can build
SymbolDatabase from version scripts.

Bug: 113263746
Test: ./bionic/tools/versioner/run_tests.py
Change-Id: Iedcfe36b51a62693668e07b86aa13592096262db
2018-10-25 14:54:39 +08:00
Logan Chien
3fc86c158f versioner: Add 28 to version list
This commit adds 28 to version list so that we can pass
slow_preprocessor_idempotence.  If 28 is not in the version list,
versioner will add another `#ifdef` guard and fail the test.

Bug: 113263746
Test: ./bionic/tools/versioner/run_tests.py
Change-Id: I3f21fc71ffd9e55326c4587bbc5e689eb72596b6
2018-10-23 21:47:39 +08:00
Chih-Hung Hsieh
153b71c407 Work around bugprone-exception-escape bug.
Bug: 117120485
Test: build with WITH_TIDY=1 and global bugprone-* checks.
Change-Id: I28aa2a176bd7d2ae4961877a8122a09666d85237
2018-10-01 16:17:44 -07:00
Elliott Hughes
5cec377f49 Address a bunch of clang-tidy complaints.
There were a bunch more unreasonable/incorrect ones, but these ones
seemed legit. Nothing very interesting, though.

Bug: N/A
Test: ran tests, benchmarks
Change-Id: If66971194d4a7b4bf6d0251bedb88e8cdc88a76f
2018-01-19 15:56:12 -08:00
Dan Albert
4d1cc9df11 Adapt to the new libc++/libc++abi update.
C++17 removed a handful of things that are used in the libclang
headers, which are used by the versioner. Enable the flag that
re-exposes these until we have a C++17 compatible libclang.

Add a stub posix_memalign to the linker. libc++abi uses posix_memalign
when allocating exceptions, which the linker does not use.

Test: make checkbuild
Bug: None
Change-Id: I32f9d0591ef99a610f27efed90a5c9fd150f0d3e
2018-01-08 14:44:42 -08:00
Josh Gao
c166113c2b versioner: remove parsing of platforms.
Leave the machinery to use a symbol database around so that we can
switch over to parsing libc.map.txt in the future.

Test: tools/versioner/run_tests.py
Change-Id: Ifa8899b698764e4aeb6aa8bb2cdb2d44a67b863f
2017-12-12 12:01:22 -08:00
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
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
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
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
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