about summary refs log tree commit diff
path: root/elf/dl-runtime.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-runtime.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-runtime.c')
-rw-r--r--elf/dl-runtime.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/elf/dl-runtime.c b/elf/dl-runtime.c
index 342b794f54..8457862ba7 100644
--- a/elf/dl-runtime.c
+++ b/elf/dl-runtime.c
@@ -325,15 +325,18 @@ _dl_profile_fixup (
 		{
 		  /* XXX Check whether both DSOs must request action or
 		     only one */
-		  if ((l->l_audit[cnt].bindflags & LA_FLG_BINDFROM) != 0
-		      && (result->l_audit[cnt].bindflags & LA_FLG_BINDTO) != 0)
+		  struct auditstate *l_state = link_map_audit_state (l, cnt);
+		  struct auditstate *result_state
+		    = link_map_audit_state (result, cnt);
+		  if ((l_state->bindflags & LA_FLG_BINDFROM) != 0
+		      && (result_state->bindflags & LA_FLG_BINDTO) != 0)
 		    {
 		      if (afct->symbind != NULL)
 			{
 			  uintptr_t new_value
 			    = afct->symbind (&sym, reloc_result->boundndx,
-					     &l->l_audit[cnt].cookie,
-					     &result->l_audit[cnt].cookie,
+					     &l_state->cookie,
+					     &result_state->cookie,
 					     &flags,
 					     strtab2 + defsym->st_name);
 			  if (new_value != (uintptr_t) sym.st_value)
@@ -421,10 +424,13 @@ _dl_profile_fixup (
 		  & (LA_SYMB_NOPLTENTER << (2 * (cnt + 1)))) == 0)
 	    {
 	      long int new_framesize = -1;
+	      struct auditstate *l_state = link_map_audit_state (l, cnt);
+	      struct auditstate *bound_state
+		= link_map_audit_state (reloc_result->bound, cnt);
 	      uintptr_t new_value
 		= afct->ARCH_LA_PLTENTER (&sym, reloc_result->boundndx,
-					  &l->l_audit[cnt].cookie,
-					  &reloc_result->bound->l_audit[cnt].cookie,
+					  &l_state->cookie,
+					  &bound_state->cookie,
 					  regs, &flags, symname,
 					  &new_framesize);
 	      if (new_value != (uintptr_t) sym.st_value)
@@ -504,9 +510,11 @@ _dl_call_pltexit (struct link_map *l, ElfW(Word) reloc_arg,
 	  && (reloc_result->enterexit
 	      & (LA_SYMB_NOPLTEXIT >> (2 * cnt))) == 0)
 	{
+	  struct auditstate *l_state = link_map_audit_state (l, cnt);
+	  struct auditstate *bound_state
+	    = link_map_audit_state (reloc_result->bound, cnt);
 	  afct->ARCH_LA_PLTEXIT (&sym, reloc_result->boundndx,
-				 &l->l_audit[cnt].cookie,
-				 &reloc_result->bound->l_audit[cnt].cookie,
+				 &l_state->cookie, &bound_state->cookie,
 				 inregs, outregs, symname);
 	}