Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Dec 2018 14:25:46 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r341687 - stable/12/libexec/rtld-elf
Message-ID:  <201812071425.wB7EPk2I009893@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Dec  7 14:25:46 2018
New Revision: 341687
URL: https://svnweb.freebsd.org/changeset/base/341687

Log:
  MFC r340858:
  rtld: parse FreeBSD Feature Control note on the object load.

Modified:
  stable/12/libexec/rtld-elf/rtld.c
  stable/12/libexec/rtld-elf/rtld.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/libexec/rtld-elf/rtld.c
==============================================================================
--- stable/12/libexec/rtld-elf/rtld.c	Fri Dec  7 13:53:29 2018	(r341686)
+++ stable/12/libexec/rtld-elf/rtld.c	Fri Dec  7 14:25:46 2018	(r341687)
@@ -1453,6 +1453,7 @@ digest_notes(Obj_Entry *obj, Elf_Addr note_start, Elf_
 		    note->n_descsz != sizeof(int32_t))
 			continue;
 		if (note->n_type != NT_FREEBSD_ABI_TAG &&
+		    note->n_type != NT_FREEBSD_FEATURE_CTL &&
 		    note->n_type != NT_FREEBSD_NOINIT_TAG)
 			continue;
 		note_name = (const char *)(note + 1);
@@ -1466,6 +1467,13 @@ digest_notes(Obj_Entry *obj, Elf_Addr note_start, Elf_
 			p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
 			obj->osrel = *(const int32_t *)(p);
 			dbg("note osrel %d", obj->osrel);
+			break;
+		case NT_FREEBSD_FEATURE_CTL:
+			/* FreeBSD ABI feature control note */
+			p = (uintptr_t)(note + 1);
+			p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
+			obj->fctl0 = *(const uint32_t *)(p);
+			dbg("note fctl0 %#x", obj->fctl0);
 			break;
 		case NT_FREEBSD_NOINIT_TAG:
 			/* FreeBSD 'crt does not call init' note */

Modified: stable/12/libexec/rtld-elf/rtld.h
==============================================================================
--- stable/12/libexec/rtld-elf/rtld.h	Fri Dec  7 13:53:29 2018	(r341686)
+++ stable/12/libexec/rtld-elf/rtld.h	Fri Dec  7 14:25:46 2018	(r341687)
@@ -236,6 +236,7 @@ typedef struct Struct_Obj_Entry {
     int fini_array_num; 	/* Number of entries in fini_array */
 
     int32_t osrel;		/* OSREL note value */
+    uint32_t fctl0;		/* FEATURE_CONTROL note desc[0] value */
 
     bool mainprog : 1;		/* True if this is the main program */
     bool rtld : 1;		/* True if this is the dynamic linker */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812071425.wB7EPk2I009893>