Skip to content

Commit 92a7283

Browse files
authored
Merge pull request #25 from keszybz/copy-fedora-changes
Copy fedora changes
2 parents f59d5ef + 465e1c1 commit 92a7283

3 files changed

Lines changed: 59 additions & 12 deletions

File tree

generate-package-notes.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ parse_options() {
158158

159159
pad_comment() {
160160
for _ in $(seq "$1"); do
161-
printf '\x00'
161+
printf '\\x00'
162162
done
163163
}
164164

@@ -223,7 +223,7 @@ write_script() {
223223
$((value_len % 256)) $((value_len / 256))
224224

225225
printf ' BYTE(0x7e) BYTE(0x1a) BYTE(0xfe) BYTE(0xca) /* Note ID */\n'
226-
printf " BYTE(0x46) BYTE(0x44) BYTE(0x4f) BYTE(0x00) /* Owner: 'FDO\x00' */" # newline will be added by write_string
226+
printf " BYTE(0x46) BYTE(0x44) BYTE(0x4f) BYTE(0x00) /* Owner: 'FDO\\\\x00' */" # newline will be added by write_string
227227

228228
write_string "$1" ' ' 'Value' "$value_len"
229229

rpm/macros.generate-package-notes-srpm

Lines changed: 0 additions & 10 deletions
This file was deleted.

rpm/macros.package-notes-srpm

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# SPDX-License-Identifier: CC0-1.0
2+
#
3+
# This file is part of the package-notes package.
4+
#
5+
# Add an ELF note with information about the package the code was compiled for.
6+
# See https://fedoraproject.org/wiki/Changes/Package_information_on_ELF_objects
7+
# for details.
8+
#
9+
# To opt out of the use of this feature completely, include this in
10+
# the spec file:
11+
#
12+
# %undefine _package_note_file
13+
#
14+
# The other macros can be undefined too to replace parts of the
15+
# functionality. If %_generate_package_note_file is undefined, the
16+
# linker script will not be generated, but the link flags may still
17+
# refer to it. This may be useful if the default generation method is
18+
# insufficient and a different mechanism will be used to generate
19+
# %_package_note_file. If %_package_note_flags is undefined, the
20+
# linker argument that injects the script will not be added to
21+
# %build_ldfags, but the linker script would still be generated.
22+
23+
# The name of the file with the linker script. If %{buildsubdir} is
24+
# defined, the file will be placed therein. Otherwise, one level up,
25+
# directly in %{_builddir}.
26+
#
27+
# Note that %{version}-%{release} used here might be redefined from
28+
# the "primary" values when subpackages with different version-release
29+
# are specified. The contents of the script use the shell variable
30+
# $RPM_PACKAGE_NAME, $RPM_PACKAGE_VERSION, $RPM_PACKAGE_RELEASE,
31+
# and $RPM_ARCH that are set early and seem to always contain the "primary"
32+
# values for the main package.
33+
%_package_note_file %{_builddir}%{?buildsubdir:/%{buildsubdir}}/.package_note-%{name}-%{version}-%{release}.%{_arch}.ld
34+
35+
# Which linker will be used? This should be either "bfd", "gold", or
36+
# "lld". Unfortunately linkers other than bfd do not support some of
37+
# the options that we'd like to use, so if this is set to anything
38+
# other than "bfd", note insertion is disabled.
39+
#
40+
# (The default linker for clang on armv7hl is lld.)
41+
%_package_note_linker %["%_target_cpu" == "armv7hl" && "%{toolchain}" == "clang" ? "lld" : "bfd"]
42+
43+
# Whether to specify the READONLY attribute for the inserted
44+
# section. We generally want this, but binutils <= 2.37 and other
45+
# linkers do not support it.
46+
%_package_note_readonly %["%_package_note_linker" == "bfd"?"1":"0"]
47+
48+
# Overall status: 1 if looks like we can insert the note, 0 otherwise
49+
%_package_note_status %[0%{?_package_note_file:1} && 0%{?name:1} && "%_target_cpu" != "noarch" && "%_package_note_linker" == "bfd" ? 1 : 0]
50+
51+
# The linker flags to be passed to the compiler to insert the notes section.
52+
%_package_note_flags %[%_package_note_status?"-Wl,%["%_package_note_linker" != "lld"?"-dT":"-T"],%{_package_note_file}":""]
53+
54+
# The command to actually generate the linker script that inserts the
55+
# notes file. This command is automatically used as part of the build
56+
# preamble.
57+
%_generate_package_note_file %[%_package_note_status?"if [ -f %{_rpmconfigdir}/generate-package-notes.sh ]; then %{_rpmconfigdir}/generate-package-notes.sh %[0%{?_package_note_readonly}?"":"--readonly no "]--package-name ${RPM_PACKAGE_NAME:?} --package-version ${RPM_PACKAGE_VERSION:?}-${RPM_PACKAGE_RELEASE:?} --package-architecture ${RPM_ARCH:?} >%{_package_note_file}; fi":""]

0 commit comments

Comments
 (0)