Update package note tool and binutils (#1563)
* Update module version tool to 2.1.2 * Add and set outdir path * Update mariner-rpm-macros.spec * Update signature for gen-ld-script.sh * Add patch for readonly keyword support in binutils * Enable linker script readonly keyword support patch * Update examples and notes in generate-package-note.py * Enable 2.36.1-4 for pkggen_core_aarch64 * Add verify-package-notes.sh script * Update signatures and add signature for verify-package-notes.sh * Install verify-package-notes.sh * Update signatures and version * Update toolchain package version for mariner-rpm-macros * Fix example output * Update manifest for binutils output flavors * Update gen-ld-script.sh hash Co-authored-by: Ismail Kose <iskose@microsoft.com>
This commit is contained in:
Родитель
cae836e6e5
Коммит
3c22062735
|
@ -1,7 +1,7 @@
|
|||
Summary: Contains a linker, an assembler, and other tools
|
||||
Name: binutils
|
||||
Version: 2.36.1
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
License: GPLv2+
|
||||
Vendor: Microsoft Corporation
|
||||
Distribution: Mariner
|
||||
|
@ -10,7 +10,8 @@ URL: https://www.gnu.org/software/binutils
|
|||
Source0: https://ftp.gnu.org/gnu/binutils/%{name}-%{version}.tar.xz
|
||||
# Patch Source: https://src.fedoraproject.org/rpms/binutils/blob/f34/f/binutils-export-demangle.h.patch
|
||||
Patch0: export-demangle-header.patch
|
||||
|
||||
# Patch1 Source https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=6b86da53d5ee2022b9065f445d23356190380746
|
||||
Patch1: linker-script-readonly-keyword-support.patch
|
||||
Provides: bundled(libiberty)
|
||||
|
||||
%description
|
||||
|
@ -127,6 +128,10 @@ sed -i 's/testsuite/ /g' gold/Makefile
|
|||
%{_libdir}/libopcodes.so
|
||||
|
||||
%changelog
|
||||
* Fri Oct 15 2021 Ismail Kose <iskose@microsoft.com> - 2.36.1-4
|
||||
- Adding READONLY keyword support in linker script
|
||||
- Verified license
|
||||
|
||||
* Tue Sep 14 2021 Pawel Winogrodzki <pawelwi@microsoft.com> - 2.36.1-3
|
||||
- Adding 'libiberty' lib and header.
|
||||
|
||||
|
|
|
@ -0,0 +1,156 @@
|
|||
From 6b86da53d5ee2022b9065f445d23356190380746 Mon Sep 17 00:00:00 2001
|
||||
From: Luca Boccassi <luca.boccassi@microsoft.com>
|
||||
Date: Wed, 21 Jul 2021 14:32:03 +0100
|
||||
Subject: [PATCH] Allows linker scripts to set the SEC_READONLY flag.
|
||||
|
||||
* ld.texi: Document new output section type.
|
||||
* ldgram.y: Add new token.
|
||||
* ldlang.c: Handle the new flag.
|
||||
* ldlang.h: Add readonly_section to list of section types.
|
||||
* ldlex.l: Add a new identifier.
|
||||
* testsuite/ld-scripts/output-section-types.t: New example linker script.
|
||||
* testsuite/ld-scripts/output-section-types.d: Test driver.
|
||||
* testsyute/ld-scripts/script.exp: Run the new test.
|
||||
---
|
||||
ld/ld.texi | 2 ++
|
||||
ld/ldgram.y | 2 ++
|
||||
ld/ldlang.c | 6 ++++++
|
||||
ld/ldlang.h | 3 ++-
|
||||
ld/ldlex.l | 1 +
|
||||
ld/testsuite/ld-scripts/output-section-types.d | 13 +++++++++++++
|
||||
ld/testsuite/ld-scripts/output-section-types.t | 7 +++++++
|
||||
ld/testsuite/ld-scripts/script.exp | 1 +
|
||||
8 files changed, 34 insertions(+), 1 deletion(-)
|
||||
create mode 100644 ld/testsuite/ld-scripts/output-section-types.d
|
||||
create mode 100644 ld/testsuite/ld-scripts/output-section-types.t
|
||||
|
||||
diff --git a/ld/ld.texi b/ld/ld.texi
|
||||
index b6d8dccea0b..60bb071fb79 100644
|
||||
--- a/ld/ld.texi
|
||||
+++ b/ld/ld.texi
|
||||
@@ -5474,6 +5474,8 @@ parentheses. The following types are defined:
|
||||
@item NOLOAD
|
||||
The section should be marked as not loadable, so that it will not be
|
||||
loaded into memory when the program is run.
|
||||
+@item READONLY
|
||||
+The section should be marked as read-only.
|
||||
@item DSECT
|
||||
@itemx COPY
|
||||
@itemx INFO
|
||||
diff --git a/ld/ldgram.y b/ld/ldgram.y
|
||||
index dd911f46169..31e0071c6fc 100644
|
||||
--- a/ld/ldgram.y
|
||||
+++ b/ld/ldgram.y
|
||||
@@ -139,6 +139,7 @@ static int error_index;
|
||||
%token REGION_ALIAS
|
||||
%token LD_FEATURE
|
||||
%token NOLOAD DSECT COPY INFO OVERLAY
|
||||
+%token READONLY
|
||||
%token DEFINED TARGET_K SEARCH_DIR MAP ENTRY
|
||||
%token <integer> NEXT
|
||||
%token SIZEOF ALIGNOF ADDR LOADADDR MAX_K MIN_K
|
||||
@@ -1123,6 +1124,7 @@ type:
|
||||
| COPY { sectype = noalloc_section; }
|
||||
| INFO { sectype = noalloc_section; }
|
||||
| OVERLAY { sectype = noalloc_section; }
|
||||
+ | READONLY { sectype = readonly_section; }
|
||||
;
|
||||
|
||||
atype:
|
||||
diff --git a/ld/ldlang.c b/ld/ldlang.c
|
||||
index 37b64c89ee1..2610be995ca 100644
|
||||
--- a/ld/ldlang.c
|
||||
+++ b/ld/ldlang.c
|
||||
@@ -2639,6 +2639,9 @@ lang_add_section (lang_statement_list_type *ptr,
|
||||
case noalloc_section:
|
||||
flags &= ~SEC_ALLOC;
|
||||
break;
|
||||
+ case readonly_section:
|
||||
+ flags |= SEC_READONLY;
|
||||
+ break;
|
||||
case noload_section:
|
||||
flags &= ~SEC_LOAD;
|
||||
flags |= SEC_NEVER_LOAD;
|
||||
@@ -4232,6 +4235,9 @@ map_input_to_output_sections
|
||||
case noalloc_section:
|
||||
flags = SEC_HAS_CONTENTS;
|
||||
break;
|
||||
+ case readonly_section:
|
||||
+ flags |= SEC_READONLY;
|
||||
+ break;
|
||||
case noload_section:
|
||||
if (bfd_get_flavour (link_info.output_bfd)
|
||||
== bfd_target_elf_flavour)
|
||||
diff --git a/ld/ldlang.h b/ld/ldlang.h
|
||||
index 6fbe16d97d9..f68ae27b409 100644
|
||||
--- a/ld/ldlang.h
|
||||
+++ b/ld/ldlang.h
|
||||
@@ -121,7 +121,8 @@ enum section_type
|
||||
first_overlay_section,
|
||||
overlay_section,
|
||||
noload_section,
|
||||
- noalloc_section
|
||||
+ noalloc_section,
|
||||
+ readonly_section
|
||||
};
|
||||
|
||||
/* This structure holds a list of program headers describing
|
||||
diff --git a/ld/ldlex.l b/ld/ldlex.l
|
||||
index c1b15263587..25b4bcaae01 100644
|
||||
--- a/ld/ldlex.l
|
||||
+++ b/ld/ldlex.l
|
||||
@@ -294,6 +294,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)*
|
||||
<BOTH,SCRIPT>"SORT_BY_INIT_PRIORITY" { RTOKEN(SORT_BY_INIT_PRIORITY); }
|
||||
<BOTH,SCRIPT>"SORT_NONE" { RTOKEN(SORT_NONE); }
|
||||
<EXPRESSION,BOTH,SCRIPT>"NOLOAD" { RTOKEN(NOLOAD);}
|
||||
+<EXPRESSION,BOTH,SCRIPT>"READONLY" { RTOKEN(READONLY);}
|
||||
<EXPRESSION,BOTH,SCRIPT>"DSECT" { RTOKEN(DSECT);}
|
||||
<EXPRESSION,BOTH,SCRIPT>"COPY" { RTOKEN(COPY);}
|
||||
<EXPRESSION,BOTH,SCRIPT>"INFO" { RTOKEN(INFO);}
|
||||
diff --git a/ld/testsuite/ld-scripts/output-section-types.d b/ld/testsuite/ld-scripts/output-section-types.d
|
||||
new file mode 100644
|
||||
index 00000000000..ab124fa4dd7
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-scripts/output-section-types.d
|
||||
@@ -0,0 +1,13 @@
|
||||
+#ld: -Toutput-section-types.t
|
||||
+#source: align2a.s
|
||||
+#objdump: -h
|
||||
+#target: [is_elf_format]
|
||||
+
|
||||
+#...
|
||||
+ . \.rom.*
|
||||
+[ ]+ALLOC, READONLY
|
||||
+ . \.ro.*
|
||||
+[ ]+CONTENTS, ALLOC, LOAD, READONLY, DATA
|
||||
+ . \.over.*
|
||||
+[ ]+CONTENTS, READONLY
|
||||
+#pass
|
||||
diff --git a/ld/testsuite/ld-scripts/output-section-types.t b/ld/testsuite/ld-scripts/output-section-types.t
|
||||
new file mode 100644
|
||||
index 00000000000..d8fdfda1a03
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-scripts/output-section-types.t
|
||||
@@ -0,0 +1,7 @@
|
||||
+SECTIONS {
|
||||
+ .rom (NOLOAD) : { LONG(1234); }
|
||||
+ .ro (READONLY) : { LONG(5678); }
|
||||
+ .over (OVERLAY) : { LONG(0123); }
|
||||
+ /DISCARD/ : { *(*) }
|
||||
+
|
||||
+}
|
||||
diff --git a/ld/testsuite/ld-scripts/script.exp b/ld/testsuite/ld-scripts/script.exp
|
||||
index 961cd08c4b1..ff50199b3ae 100644
|
||||
--- a/ld/testsuite/ld-scripts/script.exp
|
||||
+++ b/ld/testsuite/ld-scripts/script.exp
|
||||
@@ -229,6 +229,7 @@ foreach test_script $test_script_list {
|
||||
|
||||
run_dump_test "align-with-input"
|
||||
run_dump_test "pr20302"
|
||||
+run_dump_test "output-section-types"
|
||||
|
||||
run_dump_test "segment-start" {{name (default)}}
|
||||
run_dump_test "segment-start" {{name (overridden)} \
|
||||
--
|
||||
2.27.0
|
||||
|
|
@ -37,4 +37,10 @@ esac
|
|||
--name "$1" \
|
||||
--version "$2" \
|
||||
--moduleVersion "$MODULEVERSION" \
|
||||
--stamp "LinkerOnly"
|
||||
--stamp "LinkerOnly" \
|
||||
--outdir "/usr/src/mariner/BUILD/"
|
||||
|
||||
|
||||
# Verify if .note.package is properly included in a binary
|
||||
# /usr/lib/rpm/mariner/verify-package-notes.sh <input_binary> <input_note_section_binary> .note.package
|
||||
|
||||
|
|
|
@ -9,12 +9,12 @@ import argparse
|
|||
import json
|
||||
import struct
|
||||
|
||||
VERSION = "2.0.0"
|
||||
VERSION = "2.1.2"
|
||||
MEMORY_ALIGN = 4
|
||||
N_TYPE = 0xcafe1a7e
|
||||
OWNER = 'FDO'
|
||||
NOTE_SECTION_NAME = ".note.package"
|
||||
OUTPUT_LINKER_SCRIPT_NAME = "/usr/src/mariner/BUILD/module_info.ld"
|
||||
OUTPUT_LINKER_SCRIPT_NAME = "module_info.ld"
|
||||
|
||||
DESCRIPTION = 'Generate package note section'
|
||||
|
||||
|
@ -49,20 +49,22 @@ EPILOG = """
|
|||
--version "1.2.3.4" --moduleVersion "1.2.3.4-beta" \\
|
||||
--os "mariner" --osVersion "1.0" \\
|
||||
--maintainer "DEADBEEF-BBC3-4FED-9192-110C11DED04D" \\
|
||||
--copyright "Microsoft" --repo "CBL-Mariner" \\
|
||||
--copyright "Microsoft" \\
|
||||
--outdir "/source/pkgname/build/" \\
|
||||
--repo "pkgname-git-repo-name" \\
|
||||
--hash "527233b5780c25911998c4a1b3d35d38fafa39cd" \\
|
||||
--branch "1.0" --stamp "Mix"
|
||||
|
||||
- Generated example C code:
|
||||
|
||||
const char __attribute__((aligned(4), section(".note.package")))
|
||||
module_info_note_package[] = {
|
||||
0x04, 0x00, 0x00, 0x00,
|
||||
0xac, 0x01, 0x00, 0x00,
|
||||
0x7e, 0x1a, 0xfe, 0xca,
|
||||
0x46, 0x44, 0x4f, 0x00,
|
||||
....
|
||||
};
|
||||
const unsigned char __attribute__((aligned(4), section(".note.package")))
|
||||
__attribute__((used)) module_info_note_package[] = {
|
||||
0x04, 0x00, 0x00, 0x00,
|
||||
0xac, 0x01, 0x00, 0x00,
|
||||
0x7e, 0x1a, 0xfe, 0xca,
|
||||
0x46, 0x44, 0x4f, 0x00,
|
||||
....
|
||||
};
|
||||
|
||||
- Generated example Linker script:
|
||||
SECTIONS
|
||||
|
@ -83,13 +85,15 @@ EPILOG = """
|
|||
--version "1.2.3.4" --moduleVersion "1.2.3.4-beta" \\
|
||||
--os "mariner" --osVersion "1.0" \\
|
||||
--maintainer "DEADBEEF-BBC3-4FED-9192-110C11DED04D" \\
|
||||
--copyright "Microsoft" --repo "CBL-Mariner" \\
|
||||
--copyright "Microsoft" \\
|
||||
--outdir "/source/pkgname/build/" \\
|
||||
--repo "pkgname-git-repo-name" \\
|
||||
--hash "527233b5780c25911998c4a1b3d35d38fafa39cd" \\
|
||||
--branch "1.0" --stamp "LinkerOnly"
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.note.package : ALIGN(4)
|
||||
.note.package (READONLY) : ALIGN(4)
|
||||
{
|
||||
BYTE(0x04) BYTE(0x00) BYTE(0x00) BYTE(0x00)
|
||||
BYTE(0x04) BYTE(0x01) BYTE(0x00) BYTE(0x00)
|
||||
|
@ -172,8 +176,10 @@ class Note_Section():
|
|||
f.write(self.note_section)
|
||||
|
||||
def save_c_code(self, file_name, alignment):
|
||||
c_code_text = "const char __attribute__((aligned(" + str(alignment)
|
||||
c_code_text = "const unsigned char __attribute__((aligned("
|
||||
c_code_text += str(alignment)
|
||||
c_code_text += "), section(\".note.package\")))"
|
||||
c_code_text += " __attribute__((used))"
|
||||
c_code_text += " module_info_note_package[] = {"
|
||||
c_code_text += "\n\t\t"
|
||||
c_code_text += bin_to_hex(self.note_section, '0x', ', ', self.align)
|
||||
|
@ -198,9 +204,11 @@ class LinkerScript():
|
|||
self.comment = ""
|
||||
self.script_text = ""
|
||||
|
||||
def generate(self):
|
||||
def generate(self, readonly_flag=True):
|
||||
self.text += "SECTIONS\n{\n"
|
||||
self.text += "\t" + self.section_name
|
||||
if readonly_flag:
|
||||
self.text += " (READONLY)"
|
||||
self.text += " : ALIGN({})".format(self.align)
|
||||
self.text += "\n\t{\n\t\t"
|
||||
self.text += bin_to_hex(self.note_bin, 'BYTE(0x', ')', self.align)
|
||||
|
@ -228,8 +236,10 @@ class LinkerScript():
|
|||
print("Linker script, {}, was written successfully.".format(file_name))
|
||||
|
||||
|
||||
def generate_cpp_header(module_info):
|
||||
def generate_cpp_header(module_info, outdir):
|
||||
file_name = 'auto_module_info.h'
|
||||
if outdir:
|
||||
file_name = outdir + 'auto_module_info.h'
|
||||
cpp_header_content = """\
|
||||
#ifndef _AUTO_MODULE_INFO_H_
|
||||
#define _AUTO_MODULE_INFO_H_
|
||||
|
@ -254,6 +264,14 @@ def generate_cpp_header(module_info):
|
|||
print("Generated {} file...\n".format(file_name))
|
||||
|
||||
|
||||
def dir_path(path):
|
||||
if os.path.isdir(path):
|
||||
return path
|
||||
else:
|
||||
raise argparse.ArgumentTypeError(
|
||||
"readable_dir:{} does not exist".format(path))
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(
|
||||
description=DESCRIPTION,
|
||||
|
@ -263,11 +281,16 @@ def parse_args():
|
|||
parser.add_argument('--name', required=True,
|
||||
help='Package name.\n\n')
|
||||
|
||||
parser.add_argument('--outdir', type=dir_path,
|
||||
help='Folder to write .note.package.bin'
|
||||
', module_info.ld and header files.'
|
||||
' Both Windows or Linux paths are supported.\n\n')
|
||||
|
||||
parser.add_argument('--version', required=True,
|
||||
help='Package version.\n\n')
|
||||
|
||||
parser.add_argument('--type',
|
||||
choices=['bb', 'deb', 'rpm', 'agent'],
|
||||
choices=['bb', 'deb', 'rpm', 'agent', 'lib'],
|
||||
help='Package/binary type. e.g. bb for bitbake,'
|
||||
' deb for debian packages. If a binary is from rpm'
|
||||
' and, it is an agent, please use \'agent\'.\n\n')
|
||||
|
@ -284,7 +307,7 @@ def parse_args():
|
|||
|
||||
parser.add_argument('--maintainer',
|
||||
help='Maintainer information. '
|
||||
'Internal service GUID.\n\n')
|
||||
'Internal service GUID or Maintainer e-mail.\n\n')
|
||||
|
||||
parser.add_argument('--pkgid', help='package-system dependent identifier, '
|
||||
'e.g. binutils-2.30-21ubuntu~18.04.4.\n\n')
|
||||
|
@ -319,12 +342,20 @@ if __name__ == '__main__':
|
|||
print("==== ELF note generator v{} ====\n\n".format(VERSION))
|
||||
args = parse_args()
|
||||
print("Note section memory alignment: {}\n\n".format(args.endian))
|
||||
outdir = args.outdir
|
||||
|
||||
if outdir:
|
||||
os.path.join(outdir, '')
|
||||
print("outdir is: {}".format(outdir))
|
||||
|
||||
endian = Endian.map[args.endian]
|
||||
stamp_method = args.stamp
|
||||
print("Stamp method: {}\n".format(stamp_method))
|
||||
|
||||
delattr(args, 'outdir')
|
||||
delattr(args, 'endian')
|
||||
delattr(args, 'stamp')
|
||||
|
||||
module_info = {
|
||||
arg: getattr(args, arg) for arg in dir(args)
|
||||
if getattr(args, arg) is not None and arg[0] != '_'
|
||||
|
@ -332,29 +363,40 @@ if __name__ == '__main__':
|
|||
|
||||
desc_json = json.dumps(module_info, indent=1)
|
||||
note = Note_Section(N_TYPE, OWNER, desc_json, MEMORY_ALIGN, endian)
|
||||
note.save(NOTE_SECTION_NAME + ".bin")
|
||||
|
||||
generated_files = ""
|
||||
if outdir:
|
||||
note.save(outdir + NOTE_SECTION_NAME + ".bin")
|
||||
else:
|
||||
note.save(NOTE_SECTION_NAME + ".bin")
|
||||
|
||||
generated_files = ''
|
||||
if stamp_method == 'LinkerOnly':
|
||||
script = LinkerScript(NOTE_SECTION_NAME, note.get())
|
||||
script.add_comment(DO_NOT_EDIT_COMMENT)
|
||||
script.add_comment("".join(arg + ' ' for arg in sys.argv))
|
||||
script.add_comment(desc_json)
|
||||
script.generate()
|
||||
script.save(OUTPUT_LINKER_SCRIPT_NAME)
|
||||
if outdir:
|
||||
script.save(outdir + OUTPUT_LINKER_SCRIPT_NAME)
|
||||
else:
|
||||
script.save(OUTPUT_LINKER_SCRIPT_NAME)
|
||||
generated_files += OUTPUT_LINKER_SCRIPT_NAME
|
||||
else:
|
||||
script = LinkerScript(NOTE_SECTION_NAME)
|
||||
script.add_comment(DO_NOT_EDIT_COMMENT)
|
||||
script.add_comment("".join(arg + ' ' for arg in sys.argv))
|
||||
script.add_comment(desc_json)
|
||||
script.generate()
|
||||
script.save(OUTPUT_LINKER_SCRIPT_NAME)
|
||||
note.save_c_code(C_MODULE_NAME, MEMORY_ALIGN)
|
||||
script.generate(readonly_flag=False)
|
||||
if outdir:
|
||||
script.save(outdir + OUTPUT_LINKER_SCRIPT_NAME)
|
||||
note.save_c_code(outdir + C_MODULE_NAME, MEMORY_ALIGN)
|
||||
else:
|
||||
script.save(OUTPUT_LINKER_SCRIPT_NAME)
|
||||
note.save_c_code(C_MODULE_NAME, MEMORY_ALIGN)
|
||||
generated_files += OUTPUT_LINKER_SCRIPT_NAME + ", "
|
||||
generated_files += C_MODULE_NAME
|
||||
|
||||
#generate_cpp_header(module_info)
|
||||
generate_cpp_header(module_info, outdir)
|
||||
print('Successfully generated {}'
|
||||
' and {} files...'.format(
|
||||
generated_files,
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
"default-hardened-cc1": "2102bdfbb06934d95ceb3c81f789c59c9f77f91b0f996fd39588e0aa052d6f77",
|
||||
"default-hardened-ld": "4dbb822a27eed292759bc4e9cabb4b84f34fc6701535fcac2fdddac33328678b",
|
||||
"forge.lua": "7390af6e81d8d61bc6957127fe9ebdbf5223e96d3810855641bdecc2a03800b4",
|
||||
"gen-ld-script.sh": "299d6dd55f56bf58a175ce86f540299a02d9df2add199556f5825a39e34927f3",
|
||||
"generate-package-note.py": "d06816bbe7f2ae5a92d4320effd83ad6cd88bcc24db4d1649b2790d87e33599e",
|
||||
"gen-ld-script.sh": "ee9ac71a5f55752520967e08ed3e30e5430a9d2780b834d5d79c1a55373e90d5",
|
||||
"generate-package-note.py": "cf2dec2cc315581e9eb1c1952f40636f61615a4ac621b983e27513276c28818d",
|
||||
"gpgverify": "db0e050f56b694497d70603a6f5c17dd60ddbcf7cee670616851cd389f6767c4",
|
||||
"macros": "0db278ad00670f210c07ef23defe359b430767b9140d51c25115435ec3a16c3a",
|
||||
"macros.check": "79367176c3c7d10c0158b6e5d881e0fc3c8fd50c5957dad2f097c2d4a37833e7",
|
||||
|
@ -27,6 +27,8 @@
|
|||
"macros.rust-srpm": "ea69ab49a243c44ab75cfe506ba5d73046bf31e561698cc389ad5b4edb82f2b2",
|
||||
"macros.suse": "7cd64820e12a37fb22f3b09e4c5184b1f9eac94acbeea2783b1ec4940248e310",
|
||||
"pythondist.attr": "9162c91b09e01bc0c9c2e8b730424eda11ca4de35304434353dc3c8d9469419d",
|
||||
"rpmrc": "c197369d806430f581de9d5f0e89384d231745712f394ce39497ada47d1f4efe"
|
||||
"rpmrc": "c197369d806430f581de9d5f0e89384d231745712f394ce39497ada47d1f4efe",
|
||||
"verify-package-notes.sh": "121715379dcfda33f4e66b3eb5520c80c55c1b0d88348f8895d45d3b89dfe965"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
Summary: Mariner specific rpm macro files
|
||||
Name: mariner-rpm-macros
|
||||
Version: 2.0
|
||||
Release: 5%{?dist}
|
||||
Release: 6%{?dist}
|
||||
License: GPL+ AND MIT
|
||||
Vendor: Microsoft Corporation
|
||||
Distribution: Mariner
|
||||
|
@ -42,6 +42,7 @@ Source24: macros.fonts
|
|||
Source25: macros.suse
|
||||
Source26: gen-ld-script.sh
|
||||
Source27: generate-package-note.py
|
||||
Source28: verify-package-notes.sh
|
||||
Provides: redhat-rpm-config
|
||||
Provides: openblas-srpm-macros
|
||||
Provides: ocaml-srpm-macros
|
||||
|
@ -77,6 +78,7 @@ install -p -m 755 -t %{buildroot}%{rcdir} compileall2.py
|
|||
install -p -m 755 -t %{buildroot}%{rcdir} brp-*
|
||||
install -p -m 755 -t %{buildroot}%{rcdir} gen-ld-script.sh
|
||||
install -p -m 755 -t %{buildroot}%{rcdir} generate-package-note.py
|
||||
install -p -m 755 -t %{buildroot}%{rcdir} verify-package-notes.sh
|
||||
|
||||
mkdir -p %{buildroot}%{_rpmconfigdir}/macros.d
|
||||
install -p -m 644 -t %{buildroot}%{_rpmconfigdir}/macros.d macros.*
|
||||
|
@ -98,6 +100,7 @@ install -p -m 644 -t %{buildroot}%{rcluadir}/srpm forge.lua
|
|||
%{rcdir}/compileall2.py
|
||||
%{rcdir}/gen-ld-script.sh
|
||||
%{rcdir}/generate-package-note.py
|
||||
%{rcdir}/verify-package-notes.sh
|
||||
%{_rpmconfigdir}/macros.d/macros.openblas-srpm
|
||||
%{_rpmconfigdir}/macros.d/macros.nodejs-srpm
|
||||
%{_rpmconfigdir}/macros.d/macros.mono-srpm
|
||||
|
@ -120,6 +123,11 @@ install -p -m 644 -t %{buildroot}%{rcluadir}/srpm forge.lua
|
|||
%{_rpmconfigdir}/macros.d/macros.check
|
||||
|
||||
%changelog
|
||||
* Thu Oct 21 2021 Ismail Kose <iskose@microsoft.com> - 2.0-6
|
||||
- Update generate-package-note.py tool to 2.1.2
|
||||
- Add verify-package-notes.sh tool
|
||||
- Verified license
|
||||
|
||||
* Tue Sep 21 2021 Andrew Phelps <anphel@microsoft.com> - 2.0-5
|
||||
- Modify gen-ld-script.sh to ensure moduleVersion contains 4 part version
|
||||
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
# Usage:
|
||||
# ./verify-package-notes.sh <input_binary> <input_note_section_binary> <note_section_name>
|
||||
# This script verifies .note.package is successfully stamped to ELF executable or shared library
|
||||
#
|
||||
|
||||
set -e
|
||||
INPUT_BINARY=$1
|
||||
INPUT_NOTE_BINARY=$2
|
||||
SECTION_NAME=$3
|
||||
NUM_ARGS=$#
|
||||
OBJCOPY=${OBJCOPY:-objcopy}
|
||||
SECTION_OUTPUT="tmp${SECTION_NAME}.bin"
|
||||
|
||||
if [[ -z "${INPUT_BINARY}" || -z "${SECTION_NAME}" || ${NUM_ARGS} != 3 ]]; then
|
||||
echo "Usage format: ./verify-package-notes.sh <input_binary> <input_note_section_binary> <note_section_name>"
|
||||
echo "Example: ./verify-package-notes.sh ${DIR}/hello_world ${DIR}/.note.package .note.package"
|
||||
echo "This script checks if .note.package section was properly stamped to ELF binary"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
if [ ! -f "${INPUT_BINARY}" ]; then
|
||||
echo "${INPUT_BINARY} file not found!"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
if [ ! -f "${INPUT_NOTE_BINARY}" ]; then
|
||||
echo "${INPUT_NOTE_BINARY} file not found!"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
echo "${OBJCOPY} -O binary -j ${SECTION_NAME} ${INPUT_BINARY} ${SECTION_OUTPUT}"
|
||||
${OBJCOPY} -O binary -j ${SECTION_NAME} ${INPUT_BINARY} ${SECTION_OUTPUT};
|
||||
if [ $? != 0 ]; then
|
||||
echo "FAIL... Extracting ${SECTION_NAME} section attempt failed. ${SECTION_OUTPUT} file is incomplete..."
|
||||
rm -fv ${SECTION_OUTPUT}
|
||||
exit -2
|
||||
fi
|
||||
|
||||
printf "\nChecking if .note.package and note section in ${INPUT_BINARY} are identical...\n"
|
||||
if ! cmp -s "${INPUT_NOTE_BINARY}" "${SECTION_OUTPUT}" ; then
|
||||
echo "FAIL... ${SECTION_NAME} is not stamped into ${INPUT_BINARY} file..."
|
||||
rm -fv ${SECTION_OUTPUT}
|
||||
exit -3
|
||||
fi
|
||||
|
||||
rm -fv ${SECTION_OUTPUT}
|
||||
printf "\nSUCCESS... Verified ${INPUT_BINARY} successfully stamped...\n"
|
||||
exit 0
|
||||
|
|
@ -12,8 +12,8 @@ zlib-devel-1.2.11-5.cm2.aarch64.rpm
|
|||
file-5.40-1.cm2.aarch64.rpm
|
||||
file-devel-5.40-1.cm2.aarch64.rpm
|
||||
file-libs-5.40-1.cm2.aarch64.rpm
|
||||
binutils-2.36.1-3.cm2.aarch64.rpm
|
||||
binutils-devel-2.36.1-3.cm2.aarch64.rpm
|
||||
binutils-2.36.1-4.cm2.aarch64.rpm
|
||||
binutils-devel-2.36.1-4.cm2.aarch64.rpm
|
||||
gmp-6.1.2-5.cm2.aarch64.rpm
|
||||
gmp-devel-6.1.2-5.cm2.aarch64.rpm
|
||||
mpfr-4.0.1-3.cm2.aarch64.rpm
|
||||
|
@ -208,8 +208,8 @@ pcre-libs-8.44-3.cm2.aarch64.rpm
|
|||
krb5-1.18-1.cm2.aarch64.rpm
|
||||
lua-5.3.5-11.cm2.aarch64.rpm
|
||||
lua-libs-5.3.5-11.cm2.aarch64.rpm
|
||||
mariner-rpm-macros-2.0-5.cm2.noarch.rpm
|
||||
mariner-check-macros-2.0-5.cm2.noarch.rpm
|
||||
mariner-rpm-macros-2.0-6.cm2.noarch.rpm
|
||||
mariner-check-macros-2.0-6.cm2.noarch.rpm
|
||||
libassuan-2.5.1-5.cm2.aarch64.rpm
|
||||
libgpg-error-1.32-6.cm2.aarch64.rpm
|
||||
libgcrypt-1.8.7-3.cm2.aarch64.rpm
|
||||
|
|
|
@ -12,8 +12,8 @@ zlib-devel-1.2.11-5.cm2.x86_64.rpm
|
|||
file-5.40-1.cm2.x86_64.rpm
|
||||
file-devel-5.40-1.cm2.x86_64.rpm
|
||||
file-libs-5.40-1.cm2.x86_64.rpm
|
||||
binutils-2.36.1-3.cm2.x86_64.rpm
|
||||
binutils-devel-2.36.1-3.cm2.x86_64.rpm
|
||||
binutils-2.36.1-4.cm2.x86_64.rpm
|
||||
binutils-devel-2.36.1-4.cm2.x86_64.rpm
|
||||
gmp-6.1.2-5.cm2.x86_64.rpm
|
||||
gmp-devel-6.1.2-5.cm2.x86_64.rpm
|
||||
mpfr-4.0.1-3.cm2.x86_64.rpm
|
||||
|
@ -208,8 +208,8 @@ pcre-libs-8.44-3.cm2.x86_64.rpm
|
|||
krb5-1.18-1.cm2.x86_64.rpm
|
||||
lua-5.3.5-11.cm2.x86_64.rpm
|
||||
lua-libs-5.3.5-11.cm2.x86_64.rpm
|
||||
mariner-rpm-macros-2.0-5.cm2.noarch.rpm
|
||||
mariner-check-macros-2.0-5.cm2.noarch.rpm
|
||||
mariner-rpm-macros-2.0-6.cm2.noarch.rpm
|
||||
mariner-check-macros-2.0-6.cm2.noarch.rpm
|
||||
libassuan-2.5.1-5.cm2.x86_64.rpm
|
||||
libgpg-error-1.32-6.cm2.x86_64.rpm
|
||||
libgcrypt-1.8.7-3.cm2.x86_64.rpm
|
||||
|
|
|
@ -8,9 +8,9 @@ bash-4.4.18-7.cm2.aarch64.rpm
|
|||
bash-debuginfo-4.4.18-7.cm2.aarch64.rpm
|
||||
bash-devel-4.4.18-7.cm2.aarch64.rpm
|
||||
bash-lang-4.4.18-7.cm2.aarch64.rpm
|
||||
binutils-2.36.1-3.cm2.aarch64.rpm
|
||||
binutils-debuginfo-2.36.1-3.cm2.aarch64.rpm
|
||||
binutils-devel-2.36.1-3.cm2.aarch64.rpm
|
||||
binutils-2.36.1-4.cm2.aarch64.rpm
|
||||
binutils-debuginfo-2.36.1-4.cm2.aarch64.rpm
|
||||
binutils-devel-2.36.1-4.cm2.aarch64.rpm
|
||||
bison-3.1-5.cm2.aarch64.rpm
|
||||
bison-debuginfo-3.1-5.cm2.aarch64.rpm
|
||||
bzip2-1.0.8-1.cm2.aarch64.rpm
|
||||
|
@ -244,7 +244,7 @@ m4-1.4.18-4.cm2.aarch64.rpm
|
|||
m4-debuginfo-1.4.18-4.cm2.aarch64.rpm
|
||||
make-4.2.1-5.cm2.aarch64.rpm
|
||||
make-debuginfo-4.2.1-5.cm2.aarch64.rpm
|
||||
mariner-check-macros-2.0-5.cm2.noarch.rpm
|
||||
mariner-check-macros-2.0-6.cm2.noarch.rpm
|
||||
mariner-release-2.0-1.cm2.noarch.rpm
|
||||
mariner-repos-2.0-1.cm2.noarch.rpm
|
||||
mariner-repos-extras-2.0-1.cm2.noarch.rpm
|
||||
|
@ -254,7 +254,7 @@ mariner-repos-microsoft-preview-2.0-1.cm2.noarch.rpm
|
|||
mariner-repos-preview-2.0-1.cm2.noarch.rpm
|
||||
mariner-repos-ui-2.0-1.cm2.noarch.rpm
|
||||
mariner-repos-ui-preview-2.0-1.cm2.noarch.rpm
|
||||
mariner-rpm-macros-2.0-5.cm2.noarch.rpm
|
||||
mariner-rpm-macros-2.0-6.cm2.noarch.rpm
|
||||
meson-0.57.1-2.cm2.noarch.rpm
|
||||
mpfr-4.0.1-3.cm2.aarch64.rpm
|
||||
mpfr-debuginfo-4.0.1-3.cm2.aarch64.rpm
|
||||
|
|
|
@ -8,9 +8,9 @@ bash-4.4.18-7.cm2.x86_64.rpm
|
|||
bash-debuginfo-4.4.18-7.cm2.x86_64.rpm
|
||||
bash-devel-4.4.18-7.cm2.x86_64.rpm
|
||||
bash-lang-4.4.18-7.cm2.x86_64.rpm
|
||||
binutils-2.36.1-3.cm2.x86_64.rpm
|
||||
binutils-debuginfo-2.36.1-3.cm2.x86_64.rpm
|
||||
binutils-devel-2.36.1-3.cm2.x86_64.rpm
|
||||
binutils-2.36.1-4.cm2.x86_64.rpm
|
||||
binutils-debuginfo-2.36.1-4.cm2.x86_64.rpm
|
||||
binutils-devel-2.36.1-4.cm2.x86_64.rpm
|
||||
bison-3.1-5.cm2.x86_64.rpm
|
||||
bison-debuginfo-3.1-5.cm2.x86_64.rpm
|
||||
bzip2-1.0.8-1.cm2.x86_64.rpm
|
||||
|
@ -244,7 +244,7 @@ m4-1.4.18-4.cm2.x86_64.rpm
|
|||
m4-debuginfo-1.4.18-4.cm2.x86_64.rpm
|
||||
make-4.2.1-5.cm2.x86_64.rpm
|
||||
make-debuginfo-4.2.1-5.cm2.x86_64.rpm
|
||||
mariner-check-macros-2.0-5.cm2.noarch.rpm
|
||||
mariner-check-macros-2.0-6.cm2.noarch.rpm
|
||||
mariner-release-2.0-1.cm2.noarch.rpm
|
||||
mariner-repos-2.0-1.cm2.noarch.rpm
|
||||
mariner-repos-extras-2.0-1.cm2.noarch.rpm
|
||||
|
@ -254,7 +254,7 @@ mariner-repos-microsoft-preview-2.0-1.cm2.noarch.rpm
|
|||
mariner-repos-preview-2.0-1.cm2.noarch.rpm
|
||||
mariner-repos-ui-2.0-1.cm2.noarch.rpm
|
||||
mariner-repos-ui-preview-2.0-1.cm2.noarch.rpm
|
||||
mariner-rpm-macros-2.0-5.cm2.noarch.rpm
|
||||
mariner-rpm-macros-2.0-6.cm2.noarch.rpm
|
||||
meson-0.57.1-2.cm2.noarch.rpm
|
||||
mpfr-4.0.1-3.cm2.x86_64.rpm
|
||||
mpfr-debuginfo-4.0.1-3.cm2.x86_64.rpm
|
||||
|
|
|
@ -198,6 +198,7 @@ cp -v $SPECROOT/mariner-rpm-macros/macros $LFS/usr/etc/rpm/macros
|
|||
mkdir -pv $LFS/usr/lib/rpm/mariner
|
||||
cp -v $SPECROOT/mariner-rpm-macros/gen-ld-script.sh $LFS/usr/lib/rpm/mariner/gen-ld-script.sh
|
||||
cp -v $SPECROOT/mariner-rpm-macros/generate-package-note.py $LFS/usr/lib/rpm/mariner/generate-package-note.py
|
||||
cp -v $SPECROOT/mariner-rpm-macros/verify-package-notes.sh $LFS/usr/lib/rpm/mariner/verify-package-notes.sh
|
||||
cp -v $SPECROOT/rpm/brp* $LFS/usr/lib/rpm
|
||||
mkdir -pv $LFS/usr/lib/rpm/macros.d
|
||||
cp -v $MARINER_TOOLCHAIN_MANIFESTS_DIR/macros.override $LFS/usr/lib/rpm/macros.d/macros.override
|
||||
|
|
Загрузка…
Ссылка в новой задаче