diff --git a/macros.package-notes-srpm b/macros.package-notes-srpm
index d44e659..0cd369b 100644
--- a/macros.package-notes-srpm
+++ b/macros.package-notes-srpm
@@ -1,9 +1,50 @@
+# This file is part of the package-notes package.
+#
 # Add an ELF note with information about the package the code was compiled for.
 # See https://fedoraproject.org/wiki/Changes/Package_information_on_ELF_objects
 # for details.
+#
+# To opt out of the use of this feature completely, include this in
+# the spec file:
+#
+#   %undefine _package_note_file
+#
+# The other macros can be undefined too to replace parts of the
+# functionality. If %_generate_package_note_file is undefined, the
+# linker script will not be generated, but the link flags may still
+# refer to it. This may be useful if the default generation method is
+# insufficient and a different mechanism will be used to generate
+# %_package_note_file. If %_package_note_flags is undefined, the
+# linker argument that injects the script will not be added to
+# %build_ldfags, but the linker script would still be generated.
+
+# The name of the file with the linker script. If %{buildsubdir} is
+# defined, the file will be placed therein. Otherwise, one level up,
+# directly in %{_builddir}.
+#
+# Note that %{version}-%{release} used here might be redefined from
+# the "primary" values when subpackages with different version-release
+# are specified. The contents of the script use the shell variable
+# $RPM_PACKAGE_NAME, $RPM_PACKAGE_VERSION, $RPM_PACKAGE_RELEASE,
+# and $RPM_ARCH that are set early and seem to always contain the "primary"
+# values for the main package.
 %_package_note_file     %{_builddir}%{?buildsubdir:/%{buildsubdir}}/.package_note-%{name}-%{version}-%{release}.%{_arch}.ld
-%_package_note_readonly 1
 
-%_package_note_flags    %{?_package_note_file:%{?name:%["%_target_cpu" == "noarch"?"":"-Wl,-dT,%{_package_note_file}"]}}
+# Which linker will be used? Unfortunately linkers other than bfd do not
+# support some of the options that we'd like to use. This can be set to
+# disable the READONLY attribute and do other tweaks so linking works with
+# the alternative linkers. This should be either "bfd", "gold", or "lld".
+%_package_note_linker   bfd
 
-%_generate_package_note_file %{?_package_note_file:%{?name:%["%_target_cpu" == "noarch"?"":"if [ -f %{_rpmconfigdir}/generate-rpm-note.sh ]; then %{_rpmconfigdir}/generate-rpm-note.sh %{!?_package_note_readonly:--readonly=no} ${RPM_PACKAGE_NAME:?} ${RPM_PACKAGE_VERSION:?}-${RPM_PACKAGE_RELEASE:?} ${RPM_ARCH:?} >%{_package_note_file}; fi"]}}
+# Whether to specify the READONLY attribute for the inserted
+# section. We generally want this, but binutils <= 2.37 and other
+# linkers do not support it.
+%_package_note_readonly %["%_package_note_linker" == "bfd"?"1":"0"]
+
+# The linker flags to be passed to the compiler to insert the notes section.
+%_package_note_flags    %{?_package_note_file:%{?name:%["%_target_cpu" == "noarch"?"":"-Wl,%["%_package_note_linker" == "bfd"?"-dT":"-T"],%{_package_note_file}"]}}
+
+# The command to actually generate the linker script that inserts the
+# notes file. This command is automatically used as part of the build
+# preamble.
+%_generate_package_note_file %{?_package_note_file:%{?name:%["%_target_cpu" == "noarch"?"":"if [ -f %{_rpmconfigdir}/generate-rpm-note.sh ]; then %{_rpmconfigdir}/generate-rpm-note.sh %[0%{?_package_note_readonly}?"":"--readonly=no "]${RPM_PACKAGE_NAME:?} ${RPM_PACKAGE_VERSION:?}-${RPM_PACKAGE_RELEASE:?} ${RPM_ARCH:?} >%{_package_note_file}; fi"]}}