Skip to content

Commit

Permalink
chore: add ldlibs export coverage
Browse files Browse the repository at this point in the history
Change-Id: Ia4bf5a4836676bef0e04ab3601753417c5358379
  • Loading branch information
lukokr-aarch64 committed Jul 19, 2023
1 parent 651326e commit 66c88f1
Show file tree
Hide file tree
Showing 13 changed files with 365 additions and 0 deletions.
Empty file.
1 change: 1 addition & 0 deletions tests/gendiffer/ldlibs_export/app/bplist
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build.bp
61 changes: 61 additions & 0 deletions tests/gendiffer/ldlibs_export/app/build.bp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Copyright 2023 Arm Limited.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

bob_static_library {
name: "libstatic_with_ldlibs1",
ldlibs: [
"-l1",
"-luniquelib",
],
export_ldflags: [
"--export_flag1",
"--export_flag_duplicate",
],
srcs: ["lib.c"],
}

bob_static_library {
name: "libstatic_with_ldlibs2",
ldlibs: [
"-l2",
"-luniquelib",
],
export_ldflags: [
"--export_flag2",
"--export_flag_duplicate",
],
static_libs: ["libstatic_with_ldlibs1"],
srcs: ["lib.c"],
}

bob_shared_library {
name: "libshared_has_indirect_ldlibs",
srcs: ["lib.c"],
static_libs: ["libstatic_with_ldlibs2"],
}

bob_binary {
name: "binary_has_indirect_ldlibs",
srcs: ["src.c"],
static_libs: ["libstatic_with_ldlibs2"],
}

bob_binary {
name: "uses_shared",
srcs: ["src.c"],
shared_libs: ["libshared_has_indirect_ldlibs"],
}
Empty file.
59 changes: 59 additions & 0 deletions tests/gendiffer/ldlibs_export/out/android/Android.bp.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@

genrule {
name: "_check_buildbp_updates_redacted",
srcs: ["build.bp"],
out: ["androidbp_up_to_date"],
tool_files: ["scripts/verify_hash.py"],
cmd: "python $(location scripts/verify_hash.py) --hash redacted --out $(out) -- $(in)",
}

cc_binary {
name: "binary_has_indirect_ldlibs",
srcs: ["src.c"],
static_libs: [
"libstatic_with_ldlibs2",
"libstatic_with_ldlibs1",
],
ldflags: [
"--export_flag1",
"--export_flag_duplicate",
"--export_flag2",
"--export_flag_duplicate",
],
}

cc_library_shared {
name: "libshared_has_indirect_ldlibs",
srcs: ["lib.c"],
static_libs: [
"libstatic_with_ldlibs2",
"libstatic_with_ldlibs1",
],
ldflags: [
"--export_flag1",
"--export_flag_duplicate",
"--export_flag2",
"--export_flag_duplicate",
],
compile_multilib: "both",
}

cc_library_static {
name: "libstatic_with_ldlibs1",
srcs: ["lib.c"],
compile_multilib: "both",
}

cc_library_static {
name: "libstatic_with_ldlibs2",
srcs: ["lib.c"],
static_libs: ["libstatic_with_ldlibs1"],
compile_multilib: "both",
}

cc_binary {
name: "uses_shared",
srcs: ["src.c"],
shared_libs: ["libshared_has_indirect_ldlibs"],
}

Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
Empty file.
Empty file.
242 changes: 242 additions & 0 deletions tests/gendiffer/ldlibs_export/out/linux/build.ninja.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
# ******************************************************************************
# *** This file is generated and should not be edited ***
# ******************************************************************************
#
# This file contains variables, rules, and pools with name prefixes indicating
# they were generated by the following Go packages:
#
# bob [from Go package bob]
# bootstrap [from Go package github.com/google/blueprint/bootstrap]
#
ninja_required_version = 1.7.0

g.bob.BobScriptsDir = redacted/scripts

g.bob.BuildDir = redacted

g.bob.SrcDir = redacted

g.bob.toc = ${g.bob.BobScriptsDir}/library_toc.py

g.bootstrap.BinDir = redacted/.bootstrap/bin

g.bootstrap.buildDir = redacted

g.bootstrap.ninjaBuildDir = redacted

g.bootstrap.srcDir = redacted

# Limit the parallelization of linking, which is memory intensive
pool g.bob.link
depth = 1

builddir = ${g.bootstrap.ninjaBuildDir}

rule g.bob.cc
command = ${build_wrapper} ${ccompiler} -c ${cflags} ${conlyflags} -MD -MF ${depfile} ${in} -o ${out}
depfile = ${out}.d
deps = gcc
description = ${out}

rule g.bob.executable
pool = g.bob.link
command = ${build_wrapper} ${linker} ${in} -o ${out} ${ldflags} ${static_libs} -L${shared_libs_dir} ${shared_libs_flags} ${ldlibs}
description = ${out}

rule g.bob.shared_library
pool = g.bob.link
command = ${build_wrapper} ${linker} -shared ${in} -o ${out} ${ldflags} ${static_libs} -L${shared_libs_dir} ${shared_libs_flags} ${ldlibs}
description = ${out}

rule g.bob.shared_library_toc
command = ${g.bob.toc} ${in} -o ${out} ${tocflags}
description = Generate toc ${out}
restat = true

rule g.bob.static_library
command = rm -f ${out} && ${build_wrapper} ${ar} -rcs ${out} ${in}
description = ${out}

rule g.bootstrap.cp
command = cp ${in} ${out}
description = cp ${out}

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Module: binary_has_indirect_ldlibs
# Variant: target
# Type: bob_binary
# Factory: github.com/ARM-software/bob-build/core.Main.func1.1
# Defined: build.bp:51:1

m.binary_has_indirect_ldlibs_target.cflags =
m.binary_has_indirect_ldlibs_target.conlyflags =

build ${g.bob.BuildDir}/target/objects/binary_has_indirect_ldlibs/src.c.o: $
g.bob.cc ${g.bob.SrcDir}/src.c
build_wrapper =
ccompiler = gcc
cflags = ${m.binary_has_indirect_ldlibs_target.cflags}
conlyflags = ${m.binary_has_indirect_ldlibs_target.conlyflags}

build ${g.bob.BuildDir}/target/executable/binary_has_indirect_ldlibs: $
g.bob.executable $
${g.bob.BuildDir}/target/objects/binary_has_indirect_ldlibs/src.c.o | $
${g.bob.BuildDir}/target/static/libstatic_with_ldlibs2.a $
${g.bob.BuildDir}/target/static/libstatic_with_ldlibs1.a
build_wrapper =
ldflags = --export_flag1 --export_flag_duplicate --export_flag2 --export_flag_duplicate -Wl,--as-needed
ldlibs = -l1 -luniquelib -l2
linker = g++
shared_libs_dir = ${g.bob.BuildDir}/target/shared
shared_libs_flags = -Wl,-rpath-link,${g.bob.BuildDir}/target/shared
static_libs = ${g.bob.BuildDir}/target/static/libstatic_with_ldlibs2.a ${g.bob.BuildDir}/target/static/libstatic_with_ldlibs1.a

build binary_has_indirect_ldlibs: phony $
${g.bob.BuildDir}/target/executable/binary_has_indirect_ldlibs
default binary_has_indirect_ldlibs

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Module: libshared_has_indirect_ldlibs
# Variant: target
# Type: bob_shared_library
# Factory: github.com/ARM-software/bob-build/core.Main.func1.1
# Defined: build.bp:45:1

m.libshared_has_indirect_ldlibs_target.cflags =
m.libshared_has_indirect_ldlibs_target.conlyflags =

build ${g.bob.BuildDir}/target/objects/libshared_has_indirect_ldlibs/lib.c.o: $
g.bob.cc ${g.bob.SrcDir}/lib.c
build_wrapper =
ccompiler = gcc
cflags = ${m.libshared_has_indirect_ldlibs_target.cflags}
conlyflags = ${m.libshared_has_indirect_ldlibs_target.conlyflags}

build ${g.bob.BuildDir}/target/shared/libshared_has_indirect_ldlibs.so: $
g.bob.shared_library $
${g.bob.BuildDir}/target/objects/libshared_has_indirect_ldlibs/lib.c.o $
| ${g.bob.BuildDir}/target/static/libstatic_with_ldlibs2.a $
${g.bob.BuildDir}/target/static/libstatic_with_ldlibs1.a
build_wrapper =
ldflags = --export_flag1 --export_flag_duplicate --export_flag2 --export_flag_duplicate -Wl,--as-needed
ldlibs = -l1 -luniquelib -l2
linker = g++
shared_libs_dir = ${g.bob.BuildDir}/target/shared
shared_libs_flags = -Wl,-rpath-link,${g.bob.BuildDir}/target/shared
static_libs = ${g.bob.BuildDir}/target/static/libstatic_with_ldlibs2.a ${g.bob.BuildDir}/target/static/libstatic_with_ldlibs1.a

build ${g.bob.BuildDir}/target/shared/libshared_has_indirect_ldlibs.so.toc: $
g.bob.shared_library_toc $
${g.bob.BuildDir}/target/shared/libshared_has_indirect_ldlibs.so | $
${g.bob.toc}
tocflags = --format elf --objdump-tool objdump

build libshared_has_indirect_ldlibs: phony $
${g.bob.BuildDir}/target/shared/libshared_has_indirect_ldlibs.so

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Module: libstatic_with_ldlibs1
# Variant: target
# Type: bob_static_library
# Factory: github.com/ARM-software/bob-build/core.Main.func1.1
# Defined: build.bp:18:1

m.libstatic_with_ldlibs1_target.cflags =
m.libstatic_with_ldlibs1_target.conlyflags =

build ${g.bob.BuildDir}/target/objects/libstatic_with_ldlibs1/lib.c.o: $
g.bob.cc ${g.bob.SrcDir}/lib.c
build_wrapper =
ccompiler = gcc
cflags = ${m.libstatic_with_ldlibs1_target.cflags}
conlyflags = ${m.libstatic_with_ldlibs1_target.conlyflags}

build ${g.bob.BuildDir}/target/static/libstatic_with_ldlibs1.a: $
g.bob.static_library $
${g.bob.BuildDir}/target/objects/libstatic_with_ldlibs1/lib.c.o
ar = ar
build_wrapper =

build libstatic_with_ldlibs1: phony $
${g.bob.BuildDir}/target/static/libstatic_with_ldlibs1.a

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Module: libstatic_with_ldlibs2
# Variant: target
# Type: bob_static_library
# Factory: github.com/ARM-software/bob-build/core.Main.func1.1
# Defined: build.bp:31:1

m.libstatic_with_ldlibs2_target.cflags =
m.libstatic_with_ldlibs2_target.conlyflags =

build ${g.bob.BuildDir}/target/objects/libstatic_with_ldlibs2/lib.c.o: $
g.bob.cc ${g.bob.SrcDir}/lib.c
build_wrapper =
ccompiler = gcc
cflags = ${m.libstatic_with_ldlibs2_target.cflags}
conlyflags = ${m.libstatic_with_ldlibs2_target.conlyflags}

build ${g.bob.BuildDir}/target/static/libstatic_with_ldlibs2.a: $
g.bob.static_library $
${g.bob.BuildDir}/target/objects/libstatic_with_ldlibs2/lib.c.o
ar = ar
build_wrapper =

build libstatic_with_ldlibs2: phony $
${g.bob.BuildDir}/target/static/libstatic_with_ldlibs2.a

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Module: uses_shared
# Variant: target
# Type: bob_binary
# Factory: github.com/ARM-software/bob-build/core.Main.func1.1
# Defined: build.bp:57:1

m.uses_shared_target.cflags =
m.uses_shared_target.conlyflags =

build ${g.bob.BuildDir}/target/objects/uses_shared/src.c.o: g.bob.cc $
${g.bob.SrcDir}/src.c
build_wrapper =
ccompiler = gcc
cflags = ${m.uses_shared_target.cflags}
conlyflags = ${m.uses_shared_target.conlyflags}

build ${g.bob.BuildDir}/target/executable/uses_shared: g.bob.executable $
${g.bob.BuildDir}/target/objects/uses_shared/src.c.o | $
${g.bob.BuildDir}/target/shared/libshared_has_indirect_ldlibs.so.toc $
|| ${g.bob.BuildDir}/target/shared/libshared_has_indirect_ldlibs.so
build_wrapper =
ldflags = -Wl,--as-needed
ldlibs =
linker = g++
shared_libs_dir = ${g.bob.BuildDir}/target/shared
shared_libs_flags = -lshared_has_indirect_ldlibs -Wl,-rpath-link,${g.bob.BuildDir}/target/shared
static_libs =

build uses_shared: phony ${g.bob.BuildDir}/target/executable/uses_shared
default uses_shared

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Singleton: bootstrap
# Factory: github.com/google/blueprint/bootstrap.Main.func4

rule s.bootstrap.bigbpDocs
command = ${g.bootstrap.BinDir}/minibp -p -l redacted/bplist -b ${g.bootstrap.buildDir} --docs ${out} ${g.bootstrap.srcDir}/build.bp
description = minibp docs ${out}

build ${g.bootstrap.buildDir}/bin/minibp: g.bootstrap.cp $
${g.bootstrap.BinDir}/minibp
default ${g.bootstrap.buildDir}/bin/minibp

build ${g.bootstrap.buildDir}/.primary/docs/minibp.html: s.bootstrap.bigbpDocs $
| ${g.bootstrap.BinDir}/minibp
default ${g.bootstrap.buildDir}/.primary/docs/minibp.html

build blueprint_docs: phony ${g.bootstrap.buildDir}/.primary/docs/minibp.html
default blueprint_docs

build blueprint_tools: phony
default blueprint_tools

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
Empty file.
Empty file.

0 comments on commit 66c88f1

Please sign in to comment.