diff mbox series

[livepatch-build-tools,part2,v2,3/6] create-diff-object: Add is_special_section() helper function function

Message ID 20190808122334.6671-1-wipawel@amazon.de (mailing list archive)
State New, archived
Headers show
Series None | expand

Commit Message

Wieczorkiewicz, Pawel Aug. 8, 2019, 12:23 p.m. UTC
This function determines, based on the given section name, if the
sections belongs to the special sections category.

Add more special sections to special_sections[] along with a new
undefined_group_size() helper function returning 0 (undefined).
New special sections are: .altinstr_replacement.

Signed-off-by: Pawel Wieczorkiewicz <wipawel@amazon.de>
Reviewed-by: Andra-Irina Paraschiv <andraprs@amazon.com>
Reviewed-by: Bjoern Doebel <doebel@amazon.de>
Reviewed-by: Norbert Manthey <nmanthey@amazon.de>
---
v2:
* Applied suggestions from Ross:
  - const for the parameter
  - reusing special_sections array rather than duplicating it
    * moving the function from common.c to create-diff-object.c
    * strictly checking for full section names
---
 create-diff-object.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Ross Lagerwall Aug. 16, 2019, 9:24 a.m. UTC | #1
On 8/8/19 1:23 PM, Pawel Wieczorkiewicz wrote:
> This function determines, based on the given section name, if the
> sections belongs to the special sections category.
> 
> Add more special sections to special_sections[] along with a new
> undefined_group_size() helper function returning 0 (undefined).
> New special sections are: .altinstr_replacement.

Is this paragraph describing patch 5/6?

> 
> Signed-off-by: Pawel Wieczorkiewicz <wipawel@amazon.de>
> Reviewed-by: Andra-Irina Paraschiv <andraprs@amazon.com>
> Reviewed-by: Bjoern Doebel <doebel@amazon.de>
> Reviewed-by: Norbert Manthey <nmanthey@amazon.de>
> ---

Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>

(With the above paragraph and the duplicate word in the subject removed, 
which I can do during commit.)
diff mbox series

Patch

diff --git a/create-diff-object.c b/create-diff-object.c
index 4699ba0..0df3fea 100644
--- a/create-diff-object.c
+++ b/create-diff-object.c
@@ -1045,6 +1045,18 @@  static struct special_section special_sections[] = {
 	{},
 };
 
+static int is_special_section(const struct section *sec)
+{
+	struct special_section *special;
+
+	for (special = special_sections; special->name; special++) {
+		if (!strcmp(sec->name, special->name))
+			return true;
+	}
+
+	return false;
+}
+
 static int should_keep_rela_group(struct section *sec, int start, int size)
 {
 	struct rela *rela;