about summary refs log tree commit diff
path: root/elf/dl-load.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2019-11-02 20:04:02 +0100
committerFlorian Weimer <fweimer@redhat.com>2019-11-15 13:03:40 +0100
commite1d559f337de2c8ab68a6749dfe873477c883807 (patch)
tree89136f8318e432a07ea7db9fcda976b33ad99086 /elf/dl-load.c
parentc7bf5ceab6ec776ac7350d3b0190776bf532ac54 (diff)
downloadglibc-e1d559f337de2c8ab68a6749dfe873477c883807.tar.gz
glibc-e1d559f337de2c8ab68a6749dfe873477c883807.tar.xz
glibc-e1d559f337de2c8ab68a6749dfe873477c883807.zip
Introduce link_map_audit_state accessor function
To improve GCC 10 compatibility, it is necessary to remove the l_audit
zero-length array from the end of struct link_map.  In preparation of
that, this commit introduces an accessor function for the audit state,
so that it is possible to change the representation of the audit state
without adjusting the code that accesses it.

Tested on x86_64-linux-gnu.  Built on i686-gnu.

Change-Id: Id815673c29950fc011ae5301d7cde12624f658df
Diffstat (limited to 'elf/dl-load.c')
-rw-r--r--elf/dl-load.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index c1bc8c26be..6cdd11e6b0 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -973,7 +973,8 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd,
 	      for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt)
 		{
 		  if (afct->activity != NULL)
-		    afct->activity (&head->l_audit[cnt].cookie, LA_ACT_ADD);
+		    afct->activity (&link_map_audit_state (head, cnt)->cookie,
+				    LA_ACT_ADD);
 
 		  afct = afct->next;
 		}
@@ -1402,10 +1403,9 @@ cannot enable executable stack as shared object requires");
 	{
 	  if (afct->objopen != NULL)
 	    {
-	      l->l_audit[cnt].bindflags
-		= afct->objopen (l, nsid, &l->l_audit[cnt].cookie);
-
-	      l->l_audit_any_plt |= l->l_audit[cnt].bindflags != 0;
+	      struct auditstate *state = link_map_audit_state (l, cnt);
+	      state->bindflags = afct->objopen (l, nsid, &state->cookie);
+	      l->l_audit_any_plt |= state->bindflags != 0;
 	    }
 
 	  afct = afct->next;
@@ -1511,8 +1511,8 @@ open_verify (const char *name, int fd,
 	{
 	  if (afct->objsearch != NULL)
 	    {
-	      name = afct->objsearch (name, &loader->l_audit[cnt].cookie,
-				      whatcode);
+	      struct auditstate *state = link_map_audit_state (loader, cnt);
+	      name = afct->objsearch (name, &state->cookie, whatcode);
 	      if (name == NULL)
 		/* Ignore the path.  */
 		return -1;
@@ -1970,8 +1970,8 @@ _dl_map_object (struct link_map *loader, const char *name,
 	  if (afct->objsearch != NULL)
 	    {
 	      const char *before = name;
-	      name = afct->objsearch (name, &loader->l_audit[cnt].cookie,
-				      LA_SER_ORIG);
+	      struct auditstate *state = link_map_audit_state (loader, cnt);
+	      name = afct->objsearch (name, &state->cookie, LA_SER_ORIG);
 	      if (name == NULL)
 		{
 		  /* Do not try anything further.  */