Skip to content

Commit 5660484

Browse files
committed
Respond to Review Comments
1 parent b37c82e commit 5660484

File tree

3 files changed

+6
-22
lines changed

3 files changed

+6
-22
lines changed

lld/ELF/InputFiles.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -949,10 +949,6 @@ static void parseGnuPropertyNote(Ctx &ctx, ELFFileBase &f,
949949
f.andFeatures |= read32<ELFT::Endianness>(desc.data());
950950
} else if (ctx.arg.emachine == EM_AARCH64 &&
951951
type == GNU_PROPERTY_AARCH64_FEATURE_PAUTH) {
952-
// If the file being parsed is a SharedFile, we cannot pass in
953-
// the data variable as there is no InputSection to collect the
954-
// data from. As such, these are ignored. They are needed either
955-
// when loading a shared library oject.
956952
ArrayRef<uint8_t> contents = data ? *data : desc;
957953
if (!f.aarch64PauthAbiCoreInfo.empty()) {
958954
return void(
@@ -1448,11 +1444,8 @@ std::vector<uint32_t> SharedFile::parseVerneed(const ELFFile<ELFT> &obj,
14481444
template <typename ELFT>
14491445
void SharedFile::parseGnuAndFeatures(const uint8_t *base,
14501446
const typename ELFT::PhdrRange headers) {
1451-
if (headers.size() == 0)
1447+
if (headers.size() == 0 || ctx.arg.emachine != EM_AARCH64)
14521448
return;
1453-
uint32_t featureAndType = ctx.arg.emachine == EM_AARCH64
1454-
? GNU_PROPERTY_AARCH64_FEATURE_1_AND
1455-
: GNU_PROPERTY_X86_FEATURE_1_AND;
14561449

14571450
for (unsigned i = 0; i < headers.size(); i++) {
14581451
if (headers[i].p_type != PT_GNU_PROPERTY)
@@ -1465,7 +1458,7 @@ void SharedFile::parseGnuAndFeatures(const uint8_t *base,
14651458

14661459
// Read a body of a NOTE record, which consists of type-length-value fields.
14671460
ArrayRef<uint8_t> desc = note.getDesc(headers[i].p_align);
1468-
parseGnuPropertyNote<ELFT>(ctx, *this, featureAndType, desc, base);
1461+
parseGnuPropertyNote<ELFT>(ctx, *this, /*featureAndType*/GNU_PROPERTY_AARCH64_FEATURE_1_AND, desc, base);
14691462
}
14701463
}
14711464

lld/docs/ReleaseNotes.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@ Non-comprehensive list of changes in this release
2525

2626
ELF Improvements
2727
----------------
28-
* For AArch64, support for the ``-zgcs-report-dynamic`` option has been added. This will provide users with
29-
the ability to check any Dynamic Objects explicitly passed to LLD for the GNU GCS Attribute Flag. This is
30-
required for all files when linking with GCS enabled. Unless defined by the user, ``-zgcs-report-dynamic``
31-
inherits its value from the ``-zgcs-report`` option, capped at the ``warning`` level to ensure that a users
32-
module can still compile. This behaviour is designed to match the GNU ld Linker.
28+
* For AArch64, added support for ``-zgcs-report-dynamic``, enabling checks for
29+
GNU GCS Attribute Flags in Dynamic Objects when GCS is enabled. Inherits value
30+
from ``-zgcs-report`` (capped at ``warning`` level) unless user-defined,
31+
ensuring compatibility with GNU ld linker.
3332

3433
Breaking changes
3534
----------------

lld/test/ELF/aarch64-feature-gcs.s

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,9 @@
5252
## gcs-report-dynamic should report any dynamic objects that does not have the gcs property. This also ensures the inhertance from gcs-report is working correctly.
5353

5454
# RUN: ld.lld func1-gcs.o func3-gcs.o no-gcs.so force-gcs.so -z gcs-report=warning -z gcs=always 2>&1 | FileCheck --check-prefix=REPORT-WARN-DYNAMIC %s
55-
# RUN: ld.lld func1-gcs.o func3-gcs.o no-gcs.so force-gcs.so -z gcs-report-dynamic=warning -z gcs-report=warning -z gcs=always 2>&1 | FileCheck --check-prefix=REPORT-WARN-DYNAMIC %s
5655
# RUN: ld.lld func1-gcs.o func3-gcs.o no-gcs.so force-gcs.so -z gcs-report=error -z gcs=always 2>&1 | FileCheck --check-prefix=REPORT-WARN-DYNAMIC %s
57-
# RUN: ld.lld func1-gcs.o func3-gcs.o no-gcs.so force-gcs.so -z gcs-report=error -z gcs-report-dynamic=warning -z gcs=always 2>&1 | FileCheck --check-prefix=REPORT-WARN-DYNAMIC %s
5856
# RUN: ld.lld func1-gcs.o func3-gcs.o no-gcs.so force-gcs.so -z gcs-report-dynamic=warning -z gcs=always 2>&1 | FileCheck --check-prefix=REPORT-WARN-DYNAMIC %s
59-
# RUN: ld.lld func1-gcs.o func3-gcs.o no-gcs.so force-gcs.so -z gcs-report=error -z gcs-report-dynamic=warning -z gcs=always 2>&1 | FileCheck --check-prefix=REPORT-WARN-DYNAMIC %s
60-
# RUN: not ld.lld func1-gcs.o func3-gcs.o no-gcs.so force-gcs.so -z gcs-report-dynamic=error -z gcs-report=error -z gcs=always 2>&1 | FileCheck --check-prefix=REPORT-ERROR-DYNAMIC %s
6157
# RUN: not ld.lld func1-gcs.o func3-gcs.o no-gcs.so force-gcs.so -z gcs-report-dynamic=error -z gcs=always 2>&1 | FileCheck --check-prefix=REPORT-ERROR-DYNAMIC %s
62-
# RUN: ld.lld func1-gcs.o func3-gcs.o force-gcs.so -z gcs-report-dynamic=error -z gcs-report=error -z gcs=always 2>&1 | count 0
63-
# RUN: ld.lld func1-gcs.o func3-gcs.o force-gcs.so -z gcs-report-dynamic=warning -z gcs-report=error -z gcs=always 2>&1 | count 0
64-
# RUN: ld.lld func1-gcs.o func3-gcs.o force-gcs.so -z gcs-report=warning -z gcs=always 2>&1 | count 0
65-
# RUN: ld.lld func1-gcs.o func3-gcs.o force-gcs.so -z gcs-report=error -z gcs=always 2>&1 | count 0
6658
# RUN: ld.lld func1-gcs.o func3-gcs.o force-gcs.so -z gcs-report-dynamic=warning -z gcs=always 2>&1 | count 0
6759
# RUN: ld.lld func1-gcs.o func3-gcs.o force-gcs.so -z gcs-report-dynamic=error -z gcs=always 2>&1 | count 0
6860

0 commit comments

Comments
 (0)