build: Remove enabled-by special case

Doing the enabled-by processing just for the ldflags and just for the
link custom commands is confusing.  Use an option instead which is
intended to be used for such use cases.
This commit is contained in:
Sebastian Huber
2023-09-18 11:46:37 +02:00
parent de25f012b7
commit 109479e874
6 changed files with 30 additions and 18 deletions

View File

@@ -33,9 +33,7 @@ enabled-by:
includes: includes:
- testsuites/libtests/dl07 - testsuites/libtests/dl07
ldflags: ldflags:
- enabled-by: - ${LIBDL_TESTS_LDFLAGS}
- microblaze
value: -u__extendsfdf2
links: [] links: []
prepare-build: null prepare-build: null
prepare-configure: null prepare-configure: null

View File

@@ -38,9 +38,7 @@ enabled-by:
includes: includes:
- testsuites/libtests/dl08 - testsuites/libtests/dl08
ldflags: ldflags:
- enabled-by: - ${LIBDL_TESTS_LDFLAGS}
- microblaze
value: -u__extendsfdf2
links: [] links: []
prepare-build: null prepare-build: null
prepare-configure: null prepare-configure: null

View File

@@ -33,9 +33,7 @@ enabled-by:
includes: includes:
- testsuites/libtests/dl09 - testsuites/libtests/dl09
ldflags: ldflags:
- enabled-by: - ${LIBDL_TESTS_LDFLAGS}
- microblaze
value: -u__extendsfdf2
links: [] links: []
prepare-build: null prepare-build: null
prepare-configure: null prepare-configure: null

View File

@@ -22,6 +22,8 @@ links:
uid: ../optgzip uid: ../optgzip
- role: build-dependency - role: build-dependency
uid: ../optxz uid: ../optxz
- role: build-dependency
uid: optdlldflags
- role: build-dependency - role: build-dependency
uid: optrtemsld uid: optrtemsld
- role: build-dependency - role: build-dependency

View File

@@ -0,0 +1,22 @@
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
actions:
- get-string: null
- split: null
- env-assign: null
build-type: option
copyrights:
- Copyright (C) 2023 embedded brains GmbH & Co. KG
default:
- enabled-by: microblaze
value:
- -u__extendsfdf2
- enabled-by: true
value: []
description: |
Linker flags used to link libdl tests with a base image. For example, it may
be used to add undefined symbols which the linker has to resolve to pull in
services required by loaded parts.
enabled-by: true
links: []
name: LIBDL_TESTS_LDFLAGS
type: build

12
wscript
View File

@@ -360,7 +360,7 @@ class Item(object):
def __init__(self, item, bic, cmd, env, ldflags): def __init__(self, item, bic, cmd, env, ldflags):
super(link, self).__init__(self, env=env) super(link, self).__init__(self, env=env)
self.cmd = cmd self.cmd = cmd
self.ldflags = bic.ldflags + ldflags self.ldflags = ldflags
self.stlib = item.data["stlib"] self.stlib = item.data["stlib"]
self.use = (item.data["use-before"] + bic.use + self.use = (item.data["use-before"] + bic.use +
item.data["use-after"]) item.data["use-after"])
@@ -386,14 +386,8 @@ class Item(object):
[], [],
) )
ldflags = [] tsk = link(self, bic, cmd, bld.env,
for ldflag in self.data["ldflags"]: bic.ldflags + self.substitute(bld, self.data["ldflags"]))
if isinstance(ldflag, dict):
if _is_enabled(bld.env.ENABLE, ldflag["enabled-by"]):
ldflags.append(ldflag["value"])
else:
ldflags.append(ldflag)
tsk = link(self, bic, cmd, bld.env, ldflags)
tsk.set_inputs([bld.bldnode.make_node(s) for s in source]) tsk.set_inputs([bld.bldnode.make_node(s) for s in source])
tsk.set_outputs(bld.bldnode.make_node(target)) tsk.set_outputs(bld.bldnode.make_node(target))
bld.add_to_group(tsk) bld.add_to_group(tsk)