Commit Graph

15 Commits

Author SHA1 Message Date
Siva Chandra Reddy ba93b23eb3 [libc] Revert "Eliminate the internal header library target."
This reverts commit 306f2731f4. The CMake
version used by the bots does like it.
2022-06-23 20:53:09 +00:00
Siva Chandra Reddy 306f2731f4 [libc][NFC] Eliminate the internal header library target.
The internal header library target with name suffix .__header_library
has been removed as it serves no purpose now.
2022-06-23 20:45:25 +00:00
Tue Ly 667863d8a8 [libc] Fix cmake compatibility issue with list(POP_FRONT).
list(POP_FRONT) is only added to cmake in 3.15, while our base line
version is 3.13

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D127129
2022-06-06 13:36:03 -04:00
Tue Ly 800051487f [libc] Implement FLAGS option for generating all combinations for targets.
Add FLAGS option for add_header_library, add_object_library,
add_entrypoint_object, and add_libc_unittest.

In general, a flag is a string provided for supported functions under the
multi-valued option `FLAGS`.  It should be one of the following forms:
  FLAG_NAME
  FLAG_NAME__NO
  FLAG_NAME__ONLY
A target will inherit all the flags of its upstream dependency.

When we create a target `TARGET_NAME` with a flag using (add_header_library,
add_object_library, ...), its behavior will depend on the flag form as follow:
- FLAG_NAME: The following 2 targets will be generated:
    `TARGET_NAME` that has `FLAG_NAME` in its `FLAGS` property.
    `TARGET_NAME.__NO_FLAG_NAME` that depends on `DEP.__NO_FLAG_NAME` if
       `TARGET_NAME` depends on `DEP` and `DEP` has `FLAG_NAME` in its `FLAGS`
       property.
- FLAG_NAME__ONLY: Only generate 1 target `TARGET_NAME` that has `FLAG_NAME`
    in its `FLAGS` property.
- FLAG_NAME__NO: Only generate 1 target `TARGET_NAME.__NO_FLAG_NAME` that
    depends on `DEP.__NO_FLAG_NAME` if `DEP` is in its DEPENDS list and `DEP`
    has `FLAG_NAME` in its `FLAGS` property.

To show all the targets generated, pass SHOW_INTERMEDIATE_OBJECTS=ON to cmake.
To show all the targets' dependency and flags, pass
`SHOW_INTERMEDIATE_OBJECTS=DEPS` to cmake.

To completely disable a flag FLAG_NAME expansion, set the variable
`SKIP_FLAG_EXPANSION_FLAG_NAME=TRUE`.

Reviewed By: michaelrj, sivachandra

Differential Revision: https://reviews.llvm.org/D125174
2022-06-01 00:54:07 -04:00
Michael Jones 148a4b240e [libc] change ASAN condition to generator expression
Previously, building LLVM-libc with GWP ASAN was conditioned on the flag
COMPILER_RT_BUILD_GWP_ASAN, which caused issues do to the default value
of the flag being set in the compiler-rt cmake, which is seperate. Now
GWP ASAN is included based on if it exists as a target, which is more
consistent.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D119789
2022-02-15 16:12:12 -08:00
Michael Jones 7dcdbabb3b [libc] add malloc funcs as external entrypoints
malloc, calloc, realloc, and free are all functions that other libc
functions depend on, but are pulled from external sources, instead of
having an internal implementation. This patch adds a way to include
functions like that as entrypoints in the list of external entrypoints,
and includes the malloc functions using this new path.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D112104
2021-10-27 10:21:01 -07:00
Michael Jones da06d1795a [libc] add option to use SCUDO as the allocator
This patch adds LLVM_LIBC_INCLUDE_SCUDO as a flag. When enabled it
should link in the standalone version of SCUDO as the allocator for LLVM
libc.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D106502
2021-07-23 17:36:09 +00:00
Guillaume Chatelet ed4f4edea2 [libc] Allow target architecture customization
This patch provides a way to specify the default target cpu optimizations to use when compiling llvm-libc.
This ensures we don't rely on current compiler's default and allows compiling and cross compiling for a particular target.

Differential Revision: https://reviews.llvm.org/D101991
2021-05-10 07:53:48 +00:00
Siva Chandra 3d155157bf [libc] Use add_library in add_entrypoint_library instead of invoking ar. 2021-03-20 04:25:51 +00:00
Siva Chandra Reddy 6628387c9a [libc][NFC] Exclude few targets from the `all` target. 2021-02-24 08:59:55 -08:00
Siva Chandra Reddy 9ae2564396 [libc] Include object files from alias entrypoints also in entrypoint libraries.
Reviewers: abrachet

Differential Revision: https://reviews.llvm.org/D79185
2020-05-04 11:39:37 -07:00
Siva Chandra Reddy 7f12512db2 [libc][Take 2] Propagate entrypoint deps to downstream targets.
This reverts commit a8086ba4ac.
Setting couple of target properties to an empty string was missed in the
previous commit.
2020-04-21 10:29:09 -07:00
Siva Chandra Reddy a8086ba4ac [libc] Revert "Propagate entrypoint deps to downstream targets."
This reverts commit 20cb440ea2 as the
target llvmlibc seems to be failing on the bots.
2020-04-21 10:10:18 -07:00
Siva Chandra Reddy 20cb440ea2 [libc] Propagate entrypoint deps to downstream targets.
Deps are recrusively evaluated at the place they are needed. With this
change, one does not have to list recursive deps of entrypoints when
listing test targets. One will still have to explicitly list all
entrypoint objects when setting up an "add_entrypoint_library" target.

Reviewers: abrachet

Differential Revision: https://reviews.llvm.org/D78537
2020-04-21 09:58:55 -07:00
Siva Chandra Reddy 8c2e66226f [libc] [NFC] Split the CMake rules into multiple files.
Summary:
The single file was getting too long to be convenient to navigate. This
patch splits it up two into 4 files one each for header rules,
object rules, library rules, and test rules.

Reviewers: abrachet, alexshap

Subscribers: mgorny, tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D78536
2020-04-21 09:24:17 -07:00