spack/var/spack/repos/spack_repo/builtin/packages/cmake/mr-9623.patch
Harmen Stoppels b932c14008
builtin: use api v2.0 and update dir structure (#49275)
* Bump the package API of the `builtin` repo to `v2.0`
* Move `var/spack/repos/builtin` -> `var/spack/repos/spack_repo/builtin`
* Move test repos `var/spack/repos/{builtin.mock,tutorial,...}` -> `var/spack/test_repos/`
* Update package dir names to v2 format (`-` -> `_` etc)
* Change absolute imports `from spack.pkg.builtin.my_pkg ...` to relative imports `from ..my_pkg.package ...`

Users who have a repo on top of builtin should change imports from

```python
from spack.pkg.builtin.my_pkg import MyPkg
```

to

```python
from spack_repo.builtin.packages.my_pkg.package import MyPkg
```

and can configure their editors with

```
PYTHONPATH=$spack/lib/spack:$spack/var/spack/repos
```

[skip-verify-checksums]
2025-05-06 12:05:44 +02:00

68 lines
2.0 KiB
Diff

diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index a71e5f1280..003f47b439 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -112,6 +112,9 @@ public:
virtual bool IsMips() const = 0;
virtual void PrintInfo(std::ostream& os) const = 0;
+ /** Returns true if the ELF file has a dynamic section **/
+ bool HasDynamicSection() const { return this->DynamicSectionIndex >= 0; }
+
// Lookup the SONAME in the DYNAMIC section.
StringEntry const* GetSOName()
{
@@ -461,7 +464,7 @@ template <class Types>
bool cmELFInternalImpl<Types>::LoadDynamicSection()
{
// If there is no dynamic section we are done.
- if (this->DynamicSectionIndex < 0) {
+ if (!this->HasDynamicSection()) {
return false;
}
@@ -772,6 +775,11 @@ std::vector<char> cmELF::EncodeDynamicEntries(
return std::vector<char>();
}
+bool cmELF::HasDynamicSection() const
+{
+ return this->Valid() && this->Internal->HasDynamicSection();
+}
+
bool cmELF::GetSOName(std::string& soname)
{
if (StringEntry const* se = this->GetSOName()) {
diff --git a/Source/cmELF.h b/Source/cmELF.h
index ce8bd7fb92..dd37c65302 100644
--- a/Source/cmELF.h
+++ b/Source/cmELF.h
@@ -88,6 +88,9 @@ public:
std::vector<char> EncodeDynamicEntries(
const DynamicEntryList& entries) const;
+ /** Returns true if the ELF file has a dynamic section **/
+ bool HasDynamicSection() const;
+
/** Get the SONAME field if any. */
bool GetSOName(std::string& soname);
StringEntry const* GetSOName();
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 093a18b82b..3affef0394 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -2817,6 +2817,10 @@ cm::optional<bool> AdjustRPathELF(std::string const& file,
return cm::nullopt; // Not a valid ELF file.
}
+ if (!elf.HasDynamicSection()) {
+ return true; // No dynamic section to update.
+ }
+
// Get the RPATH and RUNPATH entries from it.
int se_count = 0;
cmELF::StringEntry const* se[2] = { nullptr, nullptr };
--
2.40.1