f8560c
diff -rup a/ltrace-elf.c b/ltrace-elf.c
f8560c
--- a/ltrace-elf.c	2019-02-28 17:32:49.873659818 -0500
f8560c
+++ b/ltrace-elf.c	2019-02-28 17:36:32.426779439 -0500
f8560c
@@ -639,7 +639,21 @@ ltelf_read_elf(struct ltelf *lte, const
f8560c
 			}
f8560c
 		} else if (shdr.sh_type == SHT_PROGBITS
f8560c
 			   || shdr.sh_type == SHT_NOBITS) {
f8560c
-			if (strcmp(name, ".plt") == 0) {
f8560c
+			if (strcmp(name, ".plt") == 0
f8560c
+			    && lte->second_plt_seen == 0) {
f8560c
+				lte->plt_addr = shdr.sh_addr;
f8560c
+				lte->plt_size = shdr.sh_size;
f8560c
+				lte->plt_data = elf_loaddata(scn, &shdr);
f8560c
+				if (lte->plt_data == NULL)
f8560c
+					fprintf(stderr,
f8560c
+						"Can't load .plt data\n");
f8560c
+				lte->plt_flags = shdr.sh_flags;
f8560c
+			}
f8560c
+			/* An Intel CET binary has two PLTs; the
f8560c
+			   initial PLTGOT points to the second
f8560c
+			   one.  */
f8560c
+			else if (strcmp(name, ".plt.sec") == 0) {
f8560c
+				lte->second_plt_seen = 1;
f8560c
 				lte->plt_addr = shdr.sh_addr;
f8560c
 				lte->plt_size = shdr.sh_size;
f8560c
 				lte->plt_data = elf_loaddata(scn, &shdr);
f8560c
diff -rup a/ltrace-elf.h b/ltrace-elf.h
f8560c
--- a/ltrace-elf.h	2019-02-28 17:32:49.874660328 -0500
f8560c
+++ b/ltrace-elf.h	2019-02-28 17:36:32.428779868 -0500
f8560c
@@ -45,6 +45,7 @@ struct ltelf {
f8560c
 	Elf_Data *dynsym;
f8560c
 	size_t dynsym_count;
f8560c
 	const char *dynstr;
f8560c
+	int second_plt_seen;
f8560c
 	GElf_Addr plt_addr;
f8560c
 	GElf_Word plt_flags;
f8560c
 	size_t plt_size;
f8560c
diff -rup a/sysdeps/linux-gnu/x86/plt.c b/sysdeps/linux-gnu/x86/plt.c
f8560c
--- a/sysdeps/linux-gnu/x86/plt.c	2019-02-28 17:32:49.991720041 -0500
f8560c
+++ b/sysdeps/linux-gnu/x86/plt.c	2019-02-28 17:36:32.429780083 -0500
f8560c
@@ -28,18 +28,18 @@
f8560c
 #include "trace.h"
f8560c
 
f8560c
 static GElf_Addr
f8560c
-x86_plt_offset(uint32_t i)
f8560c
+x86_plt_offset(struct ltelf *lte, uint32_t i)
f8560c
 {
f8560c
 	/* Skip the first PLT entry, which contains a stub to call the
f8560c
 	 * resolver.  */
f8560c
-	return (i + 1) * 16;
f8560c
+	return (i + (lte->second_plt_seen ? 0 : 1)) * 16;
f8560c
 }
f8560c
 
f8560c
 GElf_Addr
f8560c
 arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela *rela)
f8560c
 {
f8560c
 	uint32_t i = *VECT_ELEMENT(&lte->arch.plt_map, uint32_t, ndx);
f8560c
-	return x86_plt_offset(i) + lte->plt_addr;
f8560c
+	return x86_plt_offset(lte, i) + lte->plt_addr;
f8560c
 }
f8560c
 
f8560c
 void *
f8560c
@@ -116,6 +116,13 @@ arch_elf_init(struct ltelf *lte, struct
f8560c
 	 *	 400426:   68 00 00 00 00          pushq  $0x0
f8560c
 	 *	 40042b:   e9 e0 ff ff ff          jmpq   400410 <_init+0x18>
f8560c
 	 *
f8560c
+	 * For CET binaries it is the following:
f8560c
+	 *
f8560c
+	 *	13d0:       f3 0f 1e fa             endbr64 
f8560c
+	 *	13d4:       68 27 00 00 00          pushq  $0x27  <-- index
f8560c
+	 *	13d9:       f2 e9 71 fd ff ff       bnd jmpq 1150 <.plt>
f8560c
+	 *	13df:       90                      nop
f8560c
+	 *
f8560c
          * On i386, the argument to push is an offset of relocation to
f8560c
 	 * use.  The first PLT slot has an offset of 0x0, the second
f8560c
 	 * 0x8, etc.  On x86_64, it's directly the index that we are
f8560c
@@ -128,11 +135,33 @@ arch_elf_init(struct ltelf *lte, struct
f8560c
 	unsigned int i, sz = vect_size(&lte->plt_relocs);
f8560c
 	for (i = 0; i < sz; ++i) {
f8560c
 
f8560c
-		GElf_Addr offset = x86_plt_offset(i);
f8560c
+		GElf_Addr offset = x86_plt_offset(lte, i);
f8560c
+		uint32_t reloc_arg;
f8560c
 
f8560c
 		uint8_t byte;
f8560c
-		if (elf_read_next_u8(lte->plt_data, &offset, &byte) < 0
f8560c
-		    || byte != 0xff
f8560c
+		if (elf_read_next_u8(lte->plt_data, &offset, &byte) < 0)
f8560c
+		  continue;
f8560c
+
f8560c
+
f8560c
+		if (byte == 0xf3
f8560c
+		    && elf_read_next_u8(lte->plt_data, &offset, &byte) >= 0
f8560c
+		    && byte == 0x0f
f8560c
+		    && elf_read_next_u8(lte->plt_data, &offset, &byte) >= 0
f8560c
+		    && byte == 0x1e
f8560c
+		    && elf_read_next_u8(lte->plt_data, &offset, &byte) >= 0
f8560c
+		    && byte == 0xfa
f8560c
+		    && elf_read_next_u8(lte->plt_data, &offset, &byte) >= 0
f8560c
+		    && byte == 0x68
f8560c
+		    && elf_read_next_u32(lte->plt_data,
f8560c
+					 &offset, &reloc_arg) >= 0)
f8560c
+		  {
f8560c
+		    /* CET */
f8560c
+		    fprintf(stderr, "%d: reloc_arg is %lx\n", i, (long)reloc_arg);
f8560c
+		    *VECT_ELEMENT(&lte->arch.plt_map, unsigned int, reloc_arg) = i;
f8560c
+		    continue;
f8560c
+		  }
f8560c
+
f8560c
+		if (byte != 0xff
f8560c
 		    || elf_read_next_u8(lte->plt_data, &offset, &byte) < 0
f8560c
 		    || (byte != 0xa3 && byte != 0x25))
f8560c
 			continue;
f8560c
@@ -140,7 +169,6 @@ arch_elf_init(struct ltelf *lte, struct
f8560c
 		/* Skip immediate argument in the instruction.  */
f8560c
 		offset += 4;
f8560c
 
f8560c
-		uint32_t reloc_arg;
f8560c
 		if (elf_read_next_u8(lte->plt_data, &offset, &byte) < 0
f8560c
 		    || byte != 0x68
f8560c
 		    || elf_read_next_u32(lte->plt_data,