Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHansruedi Patzen2018-09-24 14:38:07 -0400
committerDoug Schaefer2018-09-27 14:20:38 -0400
commit920f5e3a7f26233d48e7b14aeafe9280533900b8 (patch)
treebe2a21e4089ceb905b450713658df560dea230a3 /core/org.eclipse.cdt.core.tests
parent45a30f5967fb31e4b2498ee20e0db4ba2443b1f2 (diff)
downloadorg.eclipse.cdt-920f5e3a7f26233d48e7b14aeafe9280533900b8.tar.gz
org.eclipse.cdt-920f5e3a7f26233d48e7b14aeafe9280533900b8.tar.xz
org.eclipse.cdt-920f5e3a7f26233d48e7b14aeafe9280533900b8.zip
Bug 512822: "Launch failed. Binary not found" even after building
Builds upon https://git.eclipse.org/r/#/c/92129/ but also uses the hints to only read the file if necessary. I further reverted some of the changes done with the patch for 'Bug 510987 - Properly support PIE executables as build output' since the binary will now be seen as an executable anyway. Change-Id: I075fef67f3b101ddbc64786dcbc2ca41cc114e25 Signed-off-by: Hansruedi Patzen <hansruedi.patzen@hsr.ch>
Diffstat (limited to 'core/org.eclipse.cdt.core.tests')
-rw-r--r--core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/utils/elf/ElfParserTest.java172
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/Makefile28
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be32bin0 -> 200 bytes
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be32.asm68
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be32libbin0 -> 88 bytes
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be32lib.asm35
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be64bin0 -> 272 bytes
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be64.asm60
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be64libbin0 -> 128 bytes
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be64lib.asm36
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le32bin0 -> 200 bytes
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le32.asm68
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le32libbin0 -> 88 bytes
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le32lib.asm35
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le64bin0 -> 272 bytes
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le64.asm60
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le64libbin0 -> 128 bytes
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le64lib.asm36
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/Makefile28
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be32bin0 -> 200 bytes
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be32.asm68
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be32libbin0 -> 184 bytes
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be32lib.asm65
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be64bin0 -> 272 bytes
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be64.asm60
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be64libbin0 -> 240 bytes
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be64lib.asm56
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le32bin0 -> 200 bytes
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le32.asm68
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le32libbin0 -> 184 bytes
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le32lib.asm65
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le64bin0 -> 272 bytes
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le64.asm60
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le64libbin0 -> 240 bytes
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le64lib.asm56
-rw-r--r--core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/suite/AutomatedIntegrationSuite.java2
36 files changed, 1126 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/utils/elf/ElfParserTest.java b/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/utils/elf/ElfParserTest.java
new file mode 100644
index 00000000000..0dcb0300b56
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/utils/elf/ElfParserTest.java
@@ -0,0 +1,172 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Institute for Software, HSR Hochschule fuer Technik
+ * Rapperswil, University of applied sciences and others
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Hansruedi Patzen (IFS) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.utils.elf;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
+import org.eclipse.cdt.core.model.CModelException;
+import org.eclipse.cdt.utils.elf.parser.ElfBinaryExecutable;
+import org.eclipse.cdt.utils.elf.parser.ElfBinaryShared;
+import org.eclipse.cdt.utils.elf.parser.ElfParser;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class ElfParserTest extends TestCase {
+
+ ElfParser elfParser;
+
+ public static Test suite() {
+ return new TestSuite(ElfParserTest.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ elfParser = new ElfParser();
+ super.setUp();
+ }
+
+ private byte[] readHints(final IPath path) throws IOException {
+ int bytesToRead = elfParser.getHintBufferSize();
+ byte[] hints = new byte[bytesToRead];
+ try (FileInputStream is = new FileInputStream(path.toFile())) {
+ is.read(hints);
+ }
+ return hints;
+ }
+
+ /*
+ * The most probable cause for failing one of the following tests
+ *
+ * testLE64DYNwithInterpELFoutsideHintsError_Bug512822
+ * testLE32DYNwithInterpELFoutsideHintsError_Bug512822
+ *
+ * is that the hint buffer size has been changed and the test binaries
+ * are too small and need to be updated to reflect this change as well.
+ *
+ * The original files have been manually created using nasm. See the
+ * *.asm files inside resources/elf/{inside_hints,outside_hints}/ for
+ * further details.
+ */
+ public void testLE64DYNwithInterpELFoutsideHintsError_Bug512822() throws CModelException, IOException {
+ IPath path = new Path("resources/elf/outside_hints/le64");
+ IBinaryFile binary = elfParser.getBinary(readHints(path), new Path(""));
+ assertFalse("Binary should not be an executable", binary instanceof ElfBinaryExecutable);
+ }
+
+ public void testLE32DYNwithInterpELFoutsideHintsError_Bug512822() throws CModelException, IOException {
+ IPath path = new Path("resources/elf/outside_hints/le32");
+ IBinaryFile binary = elfParser.getBinary(readHints(path), new Path(""));
+ assertFalse("Binary should not be an executable", binary instanceof ElfBinaryExecutable);
+ }
+
+ public void testLE64DYNwithInterpELFinsideHints_Bug512822() throws CModelException, IOException {
+ IPath path = new Path("resources/elf/inside_hints/le64");
+ IBinaryFile binary = elfParser.getBinary(readHints(path), new Path(""));
+ assertTrue("Binary should be an executable", binary instanceof ElfBinaryExecutable);
+ }
+
+ public void testLE32DYNwithInterpELFinsideHints_Bug512822() throws CModelException, IOException {
+ IPath path = new Path("resources/elf/inside_hints/le32");
+ IBinaryFile binary = elfParser.getBinary(readHints(path), new Path(""));
+ assertTrue("Binary should be an executable", binary instanceof ElfBinaryExecutable);
+ }
+
+ public void testLE64DYNwithInterpELFoutsideHints_Bug512822() throws CModelException, IOException {
+ IPath path = new Path("resources/elf/outside_hints/le64");
+ IBinaryFile binary = elfParser.getBinary(readHints(path), path);
+ assertTrue("Binary should be an executable", binary instanceof ElfBinaryExecutable);
+ }
+
+ public void testLE32DYNwithInterpELFoutsideHints_Bug512822() throws CModelException, IOException {
+ IPath path = new Path("resources/elf/outside_hints/le32");
+ IBinaryFile binary = elfParser.getBinary(readHints(path), path);
+ assertTrue("Binary should be an executable", binary instanceof ElfBinaryExecutable);
+ }
+
+ public void testLE32DYNnoInterpELFinsideHints_Bug512822() throws CModelException, IOException {
+ IPath path = new Path("resources/elf/inside_hints/le32lib");
+ IBinaryFile binary = elfParser.getBinary(readHints(path), new Path(""));
+ assertTrue("Binary should be a library", binary instanceof ElfBinaryShared);
+ }
+
+ public void testLE64DYNnoInterpELFinsideHints_Bug512822() throws CModelException, IOException {
+ IPath path = new Path("resources/elf/inside_hints/le64lib");
+ IBinaryFile binary = elfParser.getBinary(readHints(path), new Path(""));
+ assertTrue("Binary should be a library", binary instanceof ElfBinaryShared);
+ }
+
+ public void testLE32DYNnoInterpELFoutsideHints_Bug512822() throws CModelException, IOException {
+ IPath path = new Path("resources/elf/outside_hints/le32lib");
+ IBinaryFile binary = elfParser.getBinary(readHints(path), path);
+ assertTrue("Binary should be a library", binary instanceof ElfBinaryShared);
+ }
+
+ public void testLE64DYNnoInterpELFoutsideHints_Bug512822() throws CModelException, IOException {
+ IPath path = new Path("resources/elf/outside_hints/le64lib");
+ IBinaryFile binary = elfParser.getBinary(readHints(path), path);
+ assertTrue("Binary should be a library", binary instanceof ElfBinaryShared);
+ }
+
+ public void testBE64DYNwithInterpELFinsideHints_Bug512822() throws CModelException, IOException {
+ IPath path = new Path("resources/elf/inside_hints/be64");
+ IBinaryFile binary = elfParser.getBinary(readHints(path), new Path(""));
+ assertTrue("Binary should be an executable", binary instanceof ElfBinaryExecutable);
+ }
+
+ public void testBE32DYNwithInterpELFinsideHints_Bug512822() throws CModelException, IOException {
+ IPath path = new Path("resources/elf/inside_hints/be32");
+ IBinaryFile binary = elfParser.getBinary(readHints(path), new Path(""));
+ assertTrue("Binary should be an executable", binary instanceof ElfBinaryExecutable);
+ }
+
+ public void testBE64DYNwithInterpELFoutsideHints_Bug512822() throws CModelException, IOException {
+ IPath path = new Path("resources/elf/outside_hints/be64");
+ IBinaryFile binary = elfParser.getBinary(readHints(path), path);
+ assertTrue("Binary should be an executable", binary instanceof ElfBinaryExecutable);
+ }
+
+ public void testBE32DYNwithInterpELFoutsideHints_Bug512822() throws CModelException, IOException {
+ IPath path = new Path("resources/elf/outside_hints/be32");
+ IBinaryFile binary = elfParser.getBinary(readHints(path), path);
+ assertTrue("Binary should be an executable", binary instanceof ElfBinaryExecutable);
+ }
+
+ public void testBE32DYNnoInterpELFinsideHints_Bug512822() throws CModelException, IOException {
+ IPath path = new Path("resources/elf/inside_hints/be32lib");
+ IBinaryFile binary = elfParser.getBinary(readHints(path), new Path(""));
+ assertTrue("Binary should be a library", binary instanceof ElfBinaryShared);
+ }
+
+ public void testBE64DYNnoInterpELFinsideHints_Bug512822() throws CModelException, IOException {
+ IPath path = new Path("resources/elf/inside_hints/be64lib");
+ IBinaryFile binary = elfParser.getBinary(readHints(path), new Path(""));
+ assertTrue("Binary should be a library", binary instanceof ElfBinaryShared);
+ }
+
+ public void testBE32DYNnoInterpELFoutsideHints_Bug512822() throws CModelException, IOException {
+ IPath path = new Path("resources/elf/outside_hints/be32lib");
+ IBinaryFile binary = elfParser.getBinary(readHints(path), path);
+ assertTrue("Binary should be a library", binary instanceof ElfBinaryShared);
+ }
+
+ public void testBE64DYNnoInterpELFoutsideHints_Bug512822() throws CModelException, IOException {
+ IPath path = new Path("resources/elf/outside_hints/be64lib");
+ IBinaryFile binary = elfParser.getBinary(readHints(path), path);
+ assertTrue("Binary should be a library", binary instanceof ElfBinaryShared);
+ }
+}
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/Makefile b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/Makefile
new file mode 100644
index 00000000000..215ec1c176d
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/Makefile
@@ -0,0 +1,28 @@
+all: be32 be32lib be64 be64lib le32 le32lib le64 le64lib
+
+be32: be32.asm
+ nasm be32.asm
+
+be32lib: be32lib.asm
+ nasm be32lib.asm
+
+be64: be64.asm
+ nasm be64.asm
+
+be64lib: be64lib.asm
+ nasm be64lib.asm
+
+le32: le32.asm
+ nasm le32.asm
+
+le32lib: le32lib.asm
+ nasm le32lib.asm
+
+le64: le64.asm
+ nasm le64.asm
+
+le64lib: le64lib.asm
+ nasm le64lib.asm
+
+clean:
+ rm -f be32 be32lib be64 be64lib le32 le32lib le64 le64lib \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be32 b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be32
new file mode 100644
index 00000000000..030133e7db4
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be32
Binary files differ
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be32.asm b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be32.asm
new file mode 100644
index 00000000000..7caed300ff2
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be32.asm
@@ -0,0 +1,68 @@
+; ELF Header
+db 0x7F, 'E', 'L', 'F'; Magic start
+db 0x01; EI_CLASS: 1: 32 bit, 2: 64 bit
+db 0x02; EI_DATA: 1: LE, 2: BE
+db 0x01; EI_VERSION: 1: Original ELF
+db 0x00; EI_OSABI: 00: System-V, 03: Linux, mostly 0x00 regardless
+db 0x00; EI_ABIVERSION: mostly unused therefore 0x00
+db 0x00; EI_PAD
+dw 0x0000; EI_PAD
+dd 0x00000000; EI_PAD
+dw 0x0300; e_type: ET_DYN
+dw 0x0300; e_machine x86
+dd 0x01000000; e_version
+dd 0xC8000000; e_entry
+dd 0x34000000; e_phoff
+dd 0x00000000; e_shoff
+dd 0x00000000; e_flags
+dw 0x3400; e_ehsize
+dw 0x2000; e_phentsize
+dw 0x0400; e_phnum
+dw 0x2800; e_shentsize
+dw 0x0000; e_shnum
+dw 0x0000; e_shstrndx
+
+; Program Header 1
+dd 0x06000000; p_type: PT_PHDR
+dd 0x34000000; p_offset
+dd 0x34000000; p_vaddr
+dd 0x34000000; p_paddr
+dd 0x60000000; p_filesz
+dd 0x60000000; p_memsz
+dd 0x04000000; p_flags, 32 bit
+dd 0x04000000; p_align
+
+; Program Header 2
+dd 0x00000000; p_type: PT_NULL
+dd 0x00000000; p_offset
+dd 0x00000000; p_vaddr
+dd 0x00000000; p_paddr
+dd 0x00000000; p_filesz
+dd 0x00000000; p_memsz
+dd 0x00000000; p_flags, 32 bit
+dd 0x00000000; p_align
+
+; Program Header 3
+dd 0x03000000; p_type: PT_INTERP
+dd 0xB4000000; p_offset
+dd 0xB4000000; p_vaddr
+dd 0xB4000000; p_paddr
+dd 0x13000000; p_filesz
+dd 0x13000000; p_memsz
+dd 0x04000000; p_flags, 32 bit
+dd 0x01000000; p_align
+
+; Program Header 4
+dd 0x01000000; p_type: PT_LOAD
+dd 0x00000000; p_offset
+dd 0x00000000; p_vaddr
+dd 0x00000000; p_paddr
+dd 0xB4000000; p_filesz
+dd 0xB4000000; p_memsz
+dd 0x00000004; p_flags, 32 bit
+dd 0x00010000; p_align
+
+db '/', 'l', 'i', 'b', '/', 'l', 'd', '-'
+db 'l', 'i', 'n', 'u', 'x', '.', 's', 'o'
+db '.', '2', 0x00
+db 0x00; pad \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be32lib b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be32lib
new file mode 100644
index 00000000000..cdb8cbd4537
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be32lib
Binary files differ
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be32lib.asm b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be32lib.asm
new file mode 100644
index 00000000000..1e5e9594af8
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be32lib.asm
@@ -0,0 +1,35 @@
+; ELF Header
+db 0x7F, 'E', 'L', 'F'; Magic start
+db 0x01; EI_CLASS: 1: 32 bit, 2: 64 bit
+db 0x02; EI_DATA: 1: LE, 2: BE
+db 0x01; EI_VERSION: 1: Original ELF
+db 0x00; EI_OSABI: 00: System-V, 03: Linux, mostly 0x00 regardless
+db 0x00; EI_ABIVERSION: mostly unused therefore 0x00
+db 0x00; EI_PAD
+dw 0x0000; EI_PAD
+dd 0x00000000; EI_PAD
+dw 0x0300; e_type: ET_DYN
+dw 0x0300; e_machine x86
+dd 0x01000000; e_version
+dd 0x58000000; e_entry
+dd 0x34000000; e_phoff
+dd 0x00000000; e_shoff
+dd 0x00000000; e_flags
+dw 0x3400; e_ehsize
+dw 0x2000; e_phentsize
+dw 0x0100; e_phnum
+dw 0x2800; e_shentsize
+dw 0x0000; e_shnum
+dw 0x0000; e_shstrndx
+
+; Program Header 1
+dd 0x00000000; p_type: PT_NULL
+dd 0x00000000; p_offset
+dd 0x00000000; p_vaddr
+dd 0x00000000; p_paddr
+dd 0x00000000; p_filesz
+dd 0x00000000; p_memsz
+dd 0x00000000; p_flags, 32 bit
+dd 0x00000000; p_align
+
+dd 0x03000000; random value \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be64 b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be64
new file mode 100644
index 00000000000..f8b071a3e7c
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be64
Binary files differ
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be64.asm b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be64.asm
new file mode 100644
index 00000000000..860bedf6925
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be64.asm
@@ -0,0 +1,60 @@
+; ELF Header
+db 0x7F, 'E', 'L', 'F'; Magic start
+db 0x02; EI_CLASS: 1: 32 bit, 2: 64 bit
+db 0x02; EI_DATA: 1: LE, 2: BE
+db 0x01; EI_VERSION: 1: Original ELF
+db 0x00; EI_OSABI: 00: System-V, 03: Linux, mostly 0x00 regardless
+db 0x00; EI_ABIVERSION: mostly unused therefore 0x00
+db 0x00; EI_PAD
+dw 0x0000; EI_PAD
+dd 0x00000000; EI_PAD
+dw 0x0300; e_type: ET_DYN
+dw 0x3E00; e_machine x86-64
+dd 0x01000000; e_version
+dq 0x1001000000000000; e_entry
+dq 0x4000000000000000; e_phoff
+dq 0x0000000000000000; e_shoff
+dd 0x00000000; e_flags
+dw 0x4000; e_ehsize
+dw 0x3800; e_phentsize
+dw 0x0300; e_phnum
+dw 0x4000; e_shentsize
+dw 0x0000; e_shnum
+dw 0x0000; e_shstrndx
+
+; Program Header 1
+dd 0x06000000; p_type: PT_PHDR
+dd 0x04000000; p_flags, x86-64 only
+dq 0x4000000000000000; p_offset
+dq 0x4000000000000000; p_vaddr
+dq 0x4000000000000000; p_paddr
+dq 0xB000000000000000; p_filesz
+dq 0xB000000000000000; p_memsz
+dq 0x0800000000000000; p_align
+
+; Program Header 2
+dd 0x03000000; p_type: PT_INTERP
+dd 0x04000000; p_flags, x86-64 only
+dq 0xE800000000000000; p_offset
+dq 0xE800000000000000; p_vaddr
+dq 0xE800000000000000; p_paddr
+dq 0x1C00000000000000; p_filesz
+dq 0x1C00000000000000; p_memsz
+dq 0x0100000000000000; p_align
+
+; Program Header 3
+dd 0x01000000; p_type: PT_LOAD
+dd 0x04000000; p_flags, x86-64 only
+dq 0x0000000000000000; p_offset
+dq 0x0000000000000000; p_vaddr
+dq 0x0000000000000000; p_paddr
+dq 0xF000000000000000; p_filesz
+dq 0xF000000000000000; p_memsz
+dq 0x0001000000000000; p_align
+
+db '/', 'l', 'i', 'b', '6', '4', '/', 'l'
+db 'd', '-', 'l', 'i', 'n', 'u', 'x', '-'
+db 'x', '8', '6', '-', '6', '4', '.', 's'
+db 'o', '.', '2', 0x00
+dd 0x00; pad
+dq 0x00; pad \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be64lib b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be64lib
new file mode 100644
index 00000000000..d79a4355fb8
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be64lib
Binary files differ
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be64lib.asm b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be64lib.asm
new file mode 100644
index 00000000000..c1d2cabb441
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/be64lib.asm
@@ -0,0 +1,36 @@
+; ELF Header
+db 0x7F, 'E', 'L', 'F'; Magic start
+db 0x02; EI_CLASS: 1: 32 bit, 2: 64 bit
+db 0x02; EI_DATA: 1: LE, 2: BE
+db 0x01; EI_VERSION: 1: Original ELF
+db 0x00; EI_OSABI: 00: System-V, 03: Linux, mostly 0x00 regardless
+db 0x00; EI_ABIVERSION: mostly unused therefore 0x00
+db 0x00; EI_PAD
+dw 0x0000; EI_PAD
+dd 0x00000000; EI_PAD
+dw 0x0300; e_type: ET_DYN
+dw 0x3E00; e_machine x86-64
+dd 0x01000000; e_version
+dq 0x8000000000000000; e_entry
+dq 0x4000000000000000; e_phoff
+dq 0x0000000000000000; e_shoff
+dd 0x00000000; e_flags
+dw 0x4000; e_ehsize
+dw 0x3800; e_phentsize
+dw 0x0100; e_phnum
+dw 0x4000; e_shentsize
+dw 0x0000; e_shnum
+dw 0x0000; e_shstrndx
+
+; Program Header 1
+dd 0x00000000; p_type: PT_NULL
+dd 0x00000000; p_flags, x86-64 only
+dq 0x0000000000000000; p_offset
+dq 0x0000000000000000; p_vaddr
+dq 0x0000000000000000; p_paddr
+dq 0x0000000000000000; p_filesz
+dq 0x0000000000000000; p_memsz
+dq 0x0000000000000000; p_align
+
+dd 0x03000000; random value
+dd 0x00000000; pad; \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le32 b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le32
new file mode 100644
index 00000000000..0c8c46ba878
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le32
Binary files differ
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le32.asm b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le32.asm
new file mode 100644
index 00000000000..f6c5c1f17b9
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le32.asm
@@ -0,0 +1,68 @@
+; ELF Header
+db 0x7F, 'E', 'L', 'F'; Magic start
+db 0x01; EI_CLASS: 1: 32 bit, 2: 64 bit
+db 0x01; EI_DATA: 1: LE, 2: BE
+db 0x01; EI_VERSION: 1: Original ELF
+db 0x00; EI_OSABI: 00: System-V, 03: Linux, mostly 0x00 regardless
+db 0x00; EI_ABIVERSION: mostly unused therefore 0x00
+db 0x00; EI_PAD
+dw 0x0000; EI_PAD
+dd 0x00000000; EI_PAD
+dw 0x0003; e_type: ET_DYN
+dw 0x0003; e_machine x86
+dd 0x00000001; e_version
+dd 0x000000C8; e_entry
+dd 0x00000034; e_phoff
+dd 0x00000000; e_shoff
+dd 0x00000000; e_flags
+dw 0x0034; e_ehsize
+dw 0x0020; e_phentsize
+dw 0x0004; e_phnum
+dw 0x0028; e_shentsize
+dw 0x0000; e_shnum
+dw 0x0000; e_shstrndx
+
+; Program Header 1
+dd 0x00000006; p_type: PT_PHDR
+dd 0x00000034; p_offset
+dd 0x00000034; p_vaddr
+dd 0x00000034; p_paddr
+dd 0x00000060; p_filesz
+dd 0x00000060; p_memsz
+dd 0x00000004; p_flags, 32 bit
+dd 0x00000004; p_align
+
+; Program Header 2
+dd 0x00000000; p_type: PT_NULL
+dd 0x00000000; p_offset
+dd 0x00000000; p_vaddr
+dd 0x00000000; p_paddr
+dd 0x00000000; p_filesz
+dd 0x00000000; p_memsz
+dd 0x00000000; p_flags, 32 bit
+dd 0x00000000; p_align
+
+; Program Header 3
+dd 0x00000003; p_type: PT_INTERP
+dd 0x000000B4; p_offset
+dd 0x000000B4; p_vaddr
+dd 0x000000B4; p_paddr
+dd 0x00000013; p_filesz
+dd 0x00000013; p_memsz
+dd 0x00000004; p_flags, 32 bit
+dd 0x00000001; p_align
+
+; Program Header 4
+dd 0x00000001; p_type: PT_LOAD
+dd 0x00000000; p_offset
+dd 0x00000000; p_vaddr
+dd 0x00000000; p_paddr
+dd 0x000000B4; p_filesz
+dd 0x000000B4; p_memsz
+dd 0x00000004; p_flags, 32 bit
+dd 0x00000100; p_align
+
+db '/', 'l', 'i', 'b', '/', 'l', 'd', '-'
+db 'l', 'i', 'n', 'u', 'x', '.', 's', 'o'
+db '.', '2', 0x00
+db 0x00; pad \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le32lib b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le32lib
new file mode 100644
index 00000000000..f290fe9abe6
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le32lib
Binary files differ
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le32lib.asm b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le32lib.asm
new file mode 100644
index 00000000000..d8801c4f4f3
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le32lib.asm
@@ -0,0 +1,35 @@
+; ELF Header
+db 0x7F, 'E', 'L', 'F'; Magic start
+db 0x01; EI_CLASS: 1: 32 bit, 2: 64 bit
+db 0x01; EI_DATA: 1: LE, 2: BE
+db 0x01; EI_VERSION: 1: Original ELF
+db 0x00; EI_OSABI: 00: System-V, 03: Linux, mostly 0x00 regardless
+db 0x00; EI_ABIVERSION: mostly unused therefore 0x00
+db 0x00; EI_PAD
+dw 0x0000; EI_PAD
+dd 0x00000000; EI_PAD
+dw 0x0003; e_type: ET_DYN
+dw 0x0003; e_machine x86
+dd 0x00000001; e_version
+dd 0x00000058; e_entry
+dd 0x00000034; e_phoff
+dd 0x00000000; e_shoff
+dd 0x00000000; e_flags
+dw 0x0034; e_ehsize
+dw 0x0020; e_phentsize
+dw 0x0001; e_phnum
+dw 0x0028; e_shentsize
+dw 0x0000; e_shnum
+dw 0x0000; e_shstrndx
+
+; Program Header 1
+dd 0x00000000; p_type: PT_NULL
+dd 0x00000000; p_offset
+dd 0x00000000; p_vaddr
+dd 0x00000000; p_paddr
+dd 0x00000000; p_filesz
+dd 0x00000000; p_memsz
+dd 0x00000000; p_flags, 32 bit
+dd 0x00000000; p_align
+
+dd 0x00000003; random value \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le64 b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le64
new file mode 100644
index 00000000000..882bd7e5e89
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le64
Binary files differ
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le64.asm b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le64.asm
new file mode 100644
index 00000000000..2741ade6118
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le64.asm
@@ -0,0 +1,60 @@
+; ELF Header
+db 0x7F, 'E', 'L', 'F'; Magic start
+db 0x02; EI_CLASS: 1: 32 bit, 2: 64 bit
+db 0x01; EI_DATA: 1: LE, 2: BE
+db 0x01; EI_VERSION: 1: Original ELF
+db 0x00; EI_OSABI: 00: System-V, 03: Linux, mostly 0x00 regardless
+db 0x00; EI_ABIVERSION: mostly unused therefore 0x00
+db 0x00; EI_PAD
+dw 0x0000; EI_PAD
+dd 0x00000000; EI_PAD
+dw 0x0003; e_type: ET_DYN
+dw 0x003E; e_machine x86-64
+dd 0x00000001; e_version
+dq 0x0000000000000110; e_entry
+dq 0x0000000000000040; e_phoff
+dq 0x0000000000000000; e_shoff
+dd 0x00000000; e_flags
+dw 0x0040; e_ehsize
+dw 0x0038; e_phentsize
+dw 0x0003; e_phnum
+dw 0x0040; e_shentsize
+dw 0x0000; e_shnum
+dw 0x0000; e_shstrndx
+
+; Program Header 1
+dd 0x00000006; p_type: PT_PHDR
+dd 0x00000004; p_flags, x86-64 only
+dq 0x0000000000000040; p_offset
+dq 0x0000000000000040; p_vaddr
+dq 0x0000000000000040; p_paddr
+dq 0x00000000000000B0; p_filesz
+dq 0x00000000000000B0; p_memsz
+dq 0x0000000000000008; p_align
+
+; Program Header 2
+dd 0x00000003; p_type: PT_INTERP
+dd 0x00000004; p_flags, x86-64 only
+dq 0x00000000000000E8; p_offset
+dq 0x00000000000000E8; p_vaddr
+dq 0x00000000000000E8; p_paddr
+dq 0x000000000000001C; p_filesz
+dq 0x000000000000001C; p_memsz
+dq 0x0000000000000001; p_align
+
+; Program Header 3
+dd 0x00000001; p_type: PT_LOAD
+dd 0x00000004; p_flags, x86-64 only
+dq 0x0000000000000000; p_offset
+dq 0x0000000000000000; p_vaddr
+dq 0x0000000000000000; p_paddr
+dq 0x00000000000000F0; p_filesz
+dq 0x00000000000000F0; p_memsz
+dq 0x0000000000000100; p_align
+
+db '/', 'l', 'i', 'b', '6', '4', '/', 'l'
+db 'd', '-', 'l', 'i', 'n', 'u', 'x', '-'
+db 'x', '8', '6', '-', '6', '4', '.', 's'
+db 'o', '.', '2', 0x00
+dd 0x00; pad
+dq 0x00; pad \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le64lib b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le64lib
new file mode 100644
index 00000000000..de4071e8660
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le64lib
Binary files differ
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le64lib.asm b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le64lib.asm
new file mode 100644
index 00000000000..af68aa5ef3a
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/inside_hints/le64lib.asm
@@ -0,0 +1,36 @@
+; ELF Header
+db 0x7F, 'E', 'L', 'F'; Magic start
+db 0x02; EI_CLASS: 1: 32 bit, 2: 64 bit
+db 0x01; EI_DATA: 1: LE, 2: BE
+db 0x01; EI_VERSION: 1: Original ELF
+db 0x00; EI_OSABI: 00: System-V, 03: Linux, mostly 0x00 regardless
+db 0x00; EI_ABIVERSION: mostly unused therefore 0x00
+db 0x00; EI_PAD
+dw 0x0000; EI_PAD
+dd 0x00000000; EI_PAD
+dw 0x0003; e_type: ET_DYN
+dw 0x003E; e_machine x86-64
+dd 0x00000001; e_version
+dq 0x0000000000000080; e_entry
+dq 0x0000000000000040; e_phoff
+dq 0x0000000000000000; e_shoff
+dd 0x00000000; e_flags
+dw 0x0040; e_ehsize
+dw 0x0038; e_phentsize
+dw 0x0001; e_phnum
+dw 0x0040; e_shentsize
+dw 0x0000; e_shnum
+dw 0x0000; e_shstrndx
+
+; Program Header 1
+dd 0x00000000; p_type: PT_NULL
+dd 0x00000000; p_flags, x86-64 only
+dq 0x0000000000000000; p_offset
+dq 0x0000000000000000; p_vaddr
+dq 0x0000000000000000; p_paddr
+dq 0x0000000000000000; p_filesz
+dq 0x0000000000000000; p_memsz
+dq 0x0000000000000000; p_align
+
+dd 0x00000003; random value
+dd 0x00000000; pad \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/Makefile b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/Makefile
new file mode 100644
index 00000000000..215ec1c176d
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/Makefile
@@ -0,0 +1,28 @@
+all: be32 be32lib be64 be64lib le32 le32lib le64 le64lib
+
+be32: be32.asm
+ nasm be32.asm
+
+be32lib: be32lib.asm
+ nasm be32lib.asm
+
+be64: be64.asm
+ nasm be64.asm
+
+be64lib: be64lib.asm
+ nasm be64lib.asm
+
+le32: le32.asm
+ nasm le32.asm
+
+le32lib: le32lib.asm
+ nasm le32lib.asm
+
+le64: le64.asm
+ nasm le64.asm
+
+le64lib: le64lib.asm
+ nasm le64lib.asm
+
+clean:
+ rm -f be32 be32lib be64 be64lib le32 le32lib le64 le64lib \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be32 b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be32
new file mode 100644
index 00000000000..4b2d957f5a5
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be32
Binary files differ
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be32.asm b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be32.asm
new file mode 100644
index 00000000000..bc53c829a30
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be32.asm
@@ -0,0 +1,68 @@
+; ELF Header
+db 0x7F, 'E', 'L', 'F'; Magic start
+db 0x01; EI_CLASS: 1: 32 bit, 2: 64 bit
+db 0x02; EI_DATA: 1: LE, 2: BE
+db 0x01; EI_VERSION: 1: Original ELF
+db 0x00; EI_OSABI: 00: System-V, 03: Linux, mostly 0x00 regardless
+db 0x00; EI_ABIVERSION: mostly unused therefore 0x00
+db 0x00; EI_PAD
+dw 0x0000; EI_PAD
+dd 0x00000000; EI_PAD
+dw 0x0300; e_type: ET_DYN
+dw 0x0300; e_machine x86
+dd 0x01000000; e_version
+dd 0xC8000000; e_entry
+dd 0x34000000; e_phoff
+dd 0x00000000; e_shoff
+dd 0x00000000; e_flags
+dw 0x3400; e_ehsize
+dw 0x2000; e_phentsize
+dw 0x0400; e_phnum
+dw 0x2800; e_shentsize
+dw 0x0000; e_shnum
+dw 0x0000; e_shstrndx
+
+; Program Header 1
+dd 0x06000000; p_type: PT_PHDR
+dd 0x34000000; p_offset
+dd 0x34000000; p_vaddr
+dd 0x34000000; p_paddr
+dd 0x60000000; p_filesz
+dd 0x60000000; p_memsz
+dd 0x04000000; p_flags, 32 bit
+dd 0x04000000; p_align
+
+; Program Header 2
+dd 0x00000000; p_type: PT_NULL
+dd 0x00000000; p_offset
+dd 0x00000000; p_vaddr
+dd 0x00000000; p_paddr
+dd 0x00000000; p_filesz
+dd 0x00000000; p_memsz
+dd 0x00000000; p_flags, 32 bit
+dd 0x00000000; p_align
+
+; Program Header 3
+dd 0x01000000; p_type: PT_LOAD
+dd 0x00000000; p_offset
+dd 0x00000000; p_vaddr
+dd 0x00000000; p_paddr
+dd 0xB4000000; p_filesz
+dd 0xB4000000; p_memsz
+dd 0x00000004; p_flags, 32 bit
+dd 0x00010000; p_align
+
+; Program Header 4
+dd 0x03000000; p_type: PT_INTERP
+dd 0xB4000000; p_offset
+dd 0xB4000000; p_vaddr
+dd 0xB4000000; p_paddr
+dd 0x13000000; p_filesz
+dd 0x13000000; p_memsz
+dd 0x04000000; p_flags, 32 bit
+dd 0x01000000; p_align
+
+db '/', 'l', 'i', 'b', '/', 'l', 'd', '-'
+db 'l', 'i', 'n', 'u', 'x', '.', 's', 'o'
+db '.', '2', 0x00
+db 0x00; pad \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be32lib b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be32lib
new file mode 100644
index 00000000000..71831ef4379
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be32lib
Binary files differ
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be32lib.asm b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be32lib.asm
new file mode 100644
index 00000000000..7a9243c3da3
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be32lib.asm
@@ -0,0 +1,65 @@
+; ELF Header
+db 0x7F, 'E', 'L', 'F'; Magic start
+db 0x01; EI_CLASS: 1: 32 bit, 2: 64 bit
+db 0x02; EI_DATA: 1: LE, 2: BE
+db 0x01; EI_VERSION: 1: Original ELF
+db 0x00; EI_OSABI: 00: System-V, 03: Linux, mostly 0x00 regardless
+db 0x00; EI_ABIVERSION: mostly unused therefore 0x00
+db 0x00; EI_PAD
+dw 0x0000; EI_PAD
+dd 0x00000000; EI_PAD
+dw 0x0300; e_type: ET_DYN
+dw 0x0300; e_machine x86
+dd 0x01000000; e_version
+dd 0xB8000000; e_entry
+dd 0x34000000; e_phoff
+dd 0x00000000; e_shoff
+dd 0x00000000; e_flags
+dw 0x3400; e_ehsize
+dw 0x2000; e_phentsize
+dw 0x0400; e_phnum
+dw 0x2800; e_shentsize
+dw 0x0000; e_shnum
+dw 0x0000; e_shstrndx
+
+; Program Header 1
+dd 0x06000000; p_type: PT_PHDR
+dd 0x34000000; p_offset
+dd 0x34000000; p_vaddr
+dd 0x34000000; p_paddr
+dd 0x60000000; p_filesz
+dd 0x60000000; p_memsz
+dd 0x04000000; p_flags, 32 bit
+dd 0x04000000; p_align
+
+; Program Header 2
+dd 0x00000000; p_type: PT_NULL
+dd 0x00000000; p_offset
+dd 0x00000000; p_vaddr
+dd 0x00000000; p_paddr
+dd 0x00000000; p_filesz
+dd 0x00000000; p_memsz
+dd 0x00000000; p_flags, 32 bit
+dd 0x00000000; p_align
+
+; Program Header 3
+dd 0x01000000; p_type: PT_LOAD
+dd 0x00000000; p_offset
+dd 0x00000000; p_vaddr
+dd 0x00000000; p_paddr
+dd 0xB4000000; p_filesz
+dd 0xB4000000; p_memsz
+dd 0x00000004; p_flags, 32 bit
+dd 0x00010000; p_align
+
+; Program Header 4
+dd 0x00000000; p_type: PT_NULL
+dd 0x00000000; p_offset
+dd 0x00000000; p_vaddr
+dd 0x00000000; p_paddr
+dd 0x00000000; p_filesz
+dd 0x00000000; p_memsz
+dd 0x00000000; p_flags, 32 bit
+dd 0x00000000; p_align
+
+dd 0x03000000; random value \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be64 b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be64
new file mode 100644
index 00000000000..f583a24942f
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be64
Binary files differ
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be64.asm b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be64.asm
new file mode 100644
index 00000000000..77710a334d5
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be64.asm
@@ -0,0 +1,60 @@
+; ELF Header
+db 0x7F, 'E', 'L', 'F'; Magic start
+db 0x02; EI_CLASS: 1: 32 bit, 2: 64 bit
+db 0x02; EI_DATA: 1: LE, 2: BE
+db 0x01; EI_VERSION: 1: Original ELF
+db 0x00; EI_OSABI: 00: System-V, 03: Linux, mostly 0x00 regardless
+db 0x00; EI_ABIVERSION: mostly unused therefore 0x00
+db 0x00; EI_PAD
+dw 0x0000; EI_PAD
+dd 0x00000000; EI_PAD
+dw 0x0300; e_type: ET_DYN
+dw 0x3E00; e_machine x86-64
+dd 0x01000000; e_version
+dq 0x1001000000000000; e_entry
+dq 0x4000000000000000; e_phoff
+dq 0x0000000000000000; e_shoff
+dd 0x00000000; e_flags
+dw 0x4000; e_ehsize
+dw 0x3800; e_phentsize
+dw 0x0300; e_phnum
+dw 0x4000; e_shentsize
+dw 0x0000; e_shnum
+dw 0x0000; e_shstrndx
+
+; Program Header 1
+dd 0x06000000; p_type: PT_PHDR
+dd 0x04000000; p_flags, x86-64 only
+dq 0x4000000000000000; p_offset
+dq 0x4000000000000000; p_vaddr
+dq 0x4000000000000000; p_paddr
+dq 0xB000000000000000; p_filesz
+dq 0xB000000000000000; p_memsz
+dq 0x0800000000000000; p_align
+
+; Program Header 2
+dd 0x01000000; p_type: PT_LOAD
+dd 0x04000000; p_flags, x86-64 only
+dq 0x0000000000000000; p_offset
+dq 0x0000000000000000; p_vaddr
+dq 0x0000000000000000; p_paddr
+dq 0xF000000000000000; p_filesz
+dq 0xF000000000000000; p_memsz
+dq 0x0001000000000000; p_align
+
+; Program Header 3
+dd 0x03000000; p_type: PT_INTERP
+dd 0x04000000; p_flags, x86-64 only
+dq 0xE800000000000000; p_offset
+dq 0xE800000000000000; p_vaddr
+dq 0xE800000000000000; p_paddr
+dq 0x1C00000000000000; p_filesz
+dq 0x1C00000000000000; p_memsz
+dq 0x0100000000000000; p_align
+
+db '/', 'l', 'i', 'b', '6', '4', '/', 'l'
+db 'd', '-', 'l', 'i', 'n', 'u', 'x', '-'
+db 'x', '8', '6', '-', '6', '4', '.', 's'
+db 'o', '.', '2', 0x00
+dd 0x00; pad
+dq 0x00; pad \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be64lib b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be64lib
new file mode 100644
index 00000000000..eae3d51ed9c
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be64lib
Binary files differ
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be64lib.asm b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be64lib.asm
new file mode 100644
index 00000000000..a0e881f8ee0
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/be64lib.asm
@@ -0,0 +1,56 @@
+; ELF Header
+db 0x7F, 'E', 'L', 'F'; Magic start
+db 0x02; EI_CLASS: 1: 32 bit, 2: 64 bit
+db 0x02; EI_DATA: 1: LE, 2: BE
+db 0x01; EI_VERSION: 1: Original ELF
+db 0x00; EI_OSABI: 00: System-V, 03: Linux, mostly 0x00 regardless
+db 0x00; EI_ABIVERSION: mostly unused therefore 0x00
+db 0x00; EI_PAD
+dw 0x0000; EI_PAD
+dd 0x00000000; EI_PAD
+dw 0x0300; e_type: ET_DYN
+dw 0x3E00; e_machine x86-64
+dd 0x01000000; e_version
+dq 0x1001000000000000; e_entry
+dq 0x4000000000000000; e_phoff
+dq 0x0000000000000000; e_shoff
+dd 0x00000000; e_flags
+dw 0x4000; e_ehsize
+dw 0x3800; e_phentsize
+dw 0x0300; e_phnum
+dw 0x4000; e_shentsize
+dw 0x0000; e_shnum
+dw 0x0000; e_shstrndx
+
+; Program Header 1
+dd 0x00000000; p_type: PT_NULL
+dd 0x00000000; p_flags, x86-64 only
+dq 0x0000000000000000; p_offset
+dq 0x0000000000000000; p_vaddr
+dq 0x0000000000000000; p_paddr
+dq 0x0000000000000000; p_filesz
+dq 0x0000000000000000; p_memsz
+dq 0x0000000000000000; p_align
+
+; Program Header 2
+dd 0x00000000; p_type: PT_NULL
+dd 0x00000000; p_flags, x86-64 only
+dq 0x0000000000000000; p_offset
+dq 0x0000000000000000; p_vaddr
+dq 0x0000000000000000; p_paddr
+dq 0x0000000000000000; p_filesz
+dq 0x0000000000000000; p_memsz
+dq 0x0000000000000000; p_align
+
+; Program Header 3
+dd 0x00000000; p_type: PT_NULL
+dd 0x00000000; p_flags, x86-64 only
+dq 0x0000000000000000; p_offset
+dq 0x0000000000000000; p_vaddr
+dq 0x0000000000000000; p_paddr
+dq 0x0000000000000000; p_filesz
+dq 0x0000000000000000; p_memsz
+dq 0x0000000000000000; p_align
+
+dd 0x03000000; random value
+dd 0x00000000; pad \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le32 b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le32
new file mode 100644
index 00000000000..42a5f2b761f
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le32
Binary files differ
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le32.asm b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le32.asm
new file mode 100644
index 00000000000..c620e958fb3
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le32.asm
@@ -0,0 +1,68 @@
+; ELF Header
+db 0x7F, 'E', 'L', 'F'; Magic start
+db 0x01; EI_CLASS: 1: 32 bit, 2: 64 bit
+db 0x01; EI_DATA: 1: LE, 2: BE
+db 0x01; EI_VERSION: 1: Original ELF
+db 0x00; EI_OSABI: 00: System-V, 03: Linux, mostly 0x00 regardless
+db 0x00; EI_ABIVERSION: mostly unused therefore 0x00
+db 0x00; EI_PAD
+dw 0x0000; EI_PAD
+dd 0x00000000; EI_PAD
+dw 0x0003; e_type: ET_DYN
+dw 0x0003; e_machine x86
+dd 0x00000001; e_version
+dd 0x000000C8; e_entry
+dd 0x00000034; e_phoff
+dd 0x00000000; e_shoff
+dd 0x00000000; e_flags
+dw 0x0034; e_ehsize
+dw 0x0020; e_phentsize
+dw 0x0004; e_phnum
+dw 0x0028; e_shentsize
+dw 0x0000; e_shnum
+dw 0x0000; e_shstrndx
+
+; Program Header 1
+dd 0x00000006; p_type: PT_PHDR
+dd 0x00000034; p_offset
+dd 0x00000034; p_vaddr
+dd 0x00000034; p_paddr
+dd 0x00000060; p_filesz
+dd 0x00000060; p_memsz
+dd 0x00000004; p_flags, 32 bit
+dd 0x00000004; p_align
+
+; Program Header 2
+dd 0x00000000; p_type: PT_NULL
+dd 0x00000000; p_offset
+dd 0x00000000; p_vaddr
+dd 0x00000000; p_paddr
+dd 0x00000000; p_filesz
+dd 0x00000000; p_memsz
+dd 0x00000000; p_flags, 32 bit
+dd 0x00000000; p_align
+
+; Program Header 3
+dd 0x00000001; p_type: PT_LOAD
+dd 0x00000000; p_offset
+dd 0x00000000; p_vaddr
+dd 0x00000000; p_paddr
+dd 0x000000B4; p_filesz
+dd 0x000000B4; p_memsz
+dd 0x00000004; p_flags, 32 bit
+dd 0x00000100; p_align
+
+; Program Header 4
+dd 0x00000003; p_type: PT_INTERP
+dd 0x000000B4; p_offset
+dd 0x000000B4; p_vaddr
+dd 0x000000B4; p_paddr
+dd 0x00000013; p_filesz
+dd 0x00000013; p_memsz
+dd 0x00000004; p_flags, 32 bit
+dd 0x00000001; p_align
+
+db '/', 'l', 'i', 'b', '/', 'l', 'd', '-'
+db 'l', 'i', 'n', 'u', 'x', '.', 's', 'o'
+db '.', '2', 0x00
+db 0x00; pad \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le32lib b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le32lib
new file mode 100644
index 00000000000..bf77aea1196
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le32lib
Binary files differ
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le32lib.asm b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le32lib.asm
new file mode 100644
index 00000000000..831a6ef5a26
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le32lib.asm
@@ -0,0 +1,65 @@
+; ELF Header
+db 0x7F, 'E', 'L', 'F'; Magic start
+db 0x01; EI_CLASS: 1: 32 bit, 2: 64 bit
+db 0x01; EI_DATA: 1: LE, 2: BE
+db 0x01; EI_VERSION: 1: Original ELF
+db 0x00; EI_OSABI: 00: System-V, 03: Linux, mostly 0x00 regardless
+db 0x00; EI_ABIVERSION: mostly unused therefore 0x00
+db 0x00; EI_PAD
+dw 0x0000; EI_PAD
+dd 0x00000000; EI_PAD
+dw 0x0003; e_type: ET_DYN
+dw 0x0003; e_machine x86
+dd 0x00000001; e_version
+dd 0x000000B8; e_entry
+dd 0x00000034; e_phoff
+dd 0x00000000; e_shoff
+dd 0x00000000; e_flags
+dw 0x0034; e_ehsize
+dw 0x0020; e_phentsize
+dw 0x0004; e_phnum
+dw 0x0028; e_shentsize
+dw 0x0000; e_shnum
+dw 0x0000; e_shstrndx
+
+; Program Header 1
+dd 0x00000006; p_type: PT_PHDR
+dd 0x00000034; p_offset
+dd 0x00000034; p_vaddr
+dd 0x00000034; p_paddr
+dd 0x00000060; p_filesz
+dd 0x00000060; p_memsz
+dd 0x00000004; p_flags, 32 bit
+dd 0x00000004; p_align
+
+; Program Header 2
+dd 0x00000000; p_type: PT_NULL
+dd 0x00000000; p_offset
+dd 0x00000000; p_vaddr
+dd 0x00000000; p_paddr
+dd 0x00000000; p_filesz
+dd 0x00000000; p_memsz
+dd 0x00000000; p_flags, 32 bit
+dd 0x00000000; p_align
+
+; Program Header 3
+dd 0x00000001; p_type: PT_LOAD
+dd 0x00000000; p_offset
+dd 0x00000000; p_vaddr
+dd 0x00000000; p_paddr
+dd 0x000000B4; p_filesz
+dd 0x000000B4; p_memsz
+dd 0x00000004; p_flags, 32 bit
+dd 0x00000100; p_align
+
+; Program Header 4
+dd 0x00000000; p_type: PT_NULL
+dd 0x00000000; p_offset
+dd 0x00000000; p_vaddr
+dd 0x00000000; p_paddr
+dd 0x00000000; p_filesz
+dd 0x00000000; p_memsz
+dd 0x00000000; p_flags, 32 bit
+dd 0x00000000; p_align
+
+dd 0x00000003; random value \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le64 b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le64
new file mode 100644
index 00000000000..21859301622
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le64
Binary files differ
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le64.asm b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le64.asm
new file mode 100644
index 00000000000..b13876a40af
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le64.asm
@@ -0,0 +1,60 @@
+; ELF Header
+db 0x7F, 'E', 'L', 'F'; Magic start
+db 0x02; EI_CLASS: 1: 32 bit, 2: 64 bit
+db 0x01; EI_DATA: 1: LE, 2: BE
+db 0x01; EI_VERSION: 1: Original ELF
+db 0x00; EI_OSABI: 00: System-V, 03: Linux, mostly 0x00 regardless
+db 0x00; EI_ABIVERSION: mostly unused therefore 0x00
+db 0x00; EI_PAD
+dw 0x0000; EI_PAD
+dd 0x00000000; EI_PAD
+dw 0x0003; e_type: ET_DYN
+dw 0x003E; e_machine x86-64
+dd 0x00000001; e_version
+dq 0x0000000000000110; e_entry
+dq 0x0000000000000040; e_phoff
+dq 0x0000000000000000; e_shoff
+dd 0x00000000; e_flags
+dw 0x0040; e_ehsize
+dw 0x0038; e_phentsize
+dw 0x0003; e_phnum
+dw 0x0040; e_shentsize
+dw 0x0000; e_shnum
+dw 0x0000; e_shstrndx
+
+; Program Header 1
+dd 0x00000006; p_type: PT_PHDR
+dd 0x00000004; p_flags, x86-64 only
+dq 0x0000000000000040; p_offset
+dq 0x0000000000000040; p_vaddr
+dq 0x0000000000000040; p_paddr
+dq 0x00000000000000B0; p_filesz
+dq 0x00000000000000B0; p_memsz
+dq 0x0000000000000008; p_align
+
+; Program Header 2
+dd 0x00000001; p_type: PT_LOAD
+dd 0x00000004; p_flags, x86-64 only
+dq 0x0000000000000000; p_offset
+dq 0x0000000000000000; p_vaddr
+dq 0x0000000000000000; p_paddr
+dq 0x00000000000000F0; p_filesz
+dq 0x00000000000000F0; p_memsz
+dq 0x0000000000000100; p_align
+
+; Program Header 3
+dd 0x00000003; p_type: PT_INTERP
+dd 0x00000004; p_flags, x86-64 only
+dq 0x00000000000000E8; p_offset
+dq 0x00000000000000E8; p_vaddr
+dq 0x00000000000000E8; p_paddr
+dq 0x000000000000001C; p_filesz
+dq 0x000000000000001C; p_memsz
+dq 0x0000000000000001; p_align
+
+db '/', 'l', 'i', 'b', '6', '4', '/', 'l'
+db 'd', '-', 'l', 'i', 'n', 'u', 'x', '-'
+db 'x', '8', '6', '-', '6', '4', '.', 's'
+db 'o', '.', '2', 0x00
+dd 0x00; pad
+dq 0x00; pad \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le64lib b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le64lib
new file mode 100644
index 00000000000..4cd92f1ce22
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le64lib
Binary files differ
diff --git a/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le64lib.asm b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le64lib.asm
new file mode 100644
index 00000000000..824a0d97f72
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/elf/outside_hints/le64lib.asm
@@ -0,0 +1,56 @@
+; ELF Header
+db 0x7F, 'E', 'L', 'F'; Magic start
+db 0x02; EI_CLASS: 1: 32 bit, 2: 64 bit
+db 0x01; EI_DATA: 1: LE, 2: BE
+db 0x01; EI_VERSION: 1: Original ELF
+db 0x00; EI_OSABI: 00: System-V, 03: Linux, mostly 0x00 regardless
+db 0x00; EI_ABIVERSION: mostly unused therefore 0x00
+db 0x00; EI_PAD
+dw 0x0000; EI_PAD
+dd 0x00000000; EI_PAD
+dw 0x0003; e_type: ET_DYN
+dw 0x003E; e_machine x86-64
+dd 0x00000001; e_version
+dq 0x0000000000000110; e_entry
+dq 0x0000000000000040; e_phoff
+dq 0x0000000000000000; e_shoff
+dd 0x00000000; e_flags
+dw 0x0040; e_ehsize
+dw 0x0038; e_phentsize
+dw 0x0003; e_phnum
+dw 0x0040; e_shentsize
+dw 0x0000; e_shnum
+dw 0x0000; e_shstrndx
+
+; Program Header 1
+dd 0x00000000; p_type: PT_NULL
+dd 0x00000000; p_flags, x86-64 only
+dq 0x0000000000000000; p_offset
+dq 0x0000000000000000; p_vaddr
+dq 0x0000000000000000; p_paddr
+dq 0x0000000000000000; p_filesz
+dq 0x0000000000000000; p_memsz
+dq 0x0000000000000000; p_align
+
+; Program Header 2
+dd 0x00000000; p_type: PT_NULL
+dd 0x00000000; p_flags, x86-64 only
+dq 0x0000000000000000; p_offset
+dq 0x0000000000000000; p_vaddr
+dq 0x0000000000000000; p_paddr
+dq 0x0000000000000000; p_filesz
+dq 0x0000000000000000; p_memsz
+dq 0x0000000000000000; p_align
+
+; Program Header 3
+dd 0x00000000; p_type: PT_NULL
+dd 0x00000000; p_flags, x86-64 only
+dq 0x0000000000000000; p_offset
+dq 0x0000000000000000; p_vaddr
+dq 0x0000000000000000; p_paddr
+dq 0x0000000000000000; p_filesz
+dq 0x0000000000000000; p_memsz
+dq 0x0000000000000000; p_align
+
+dd 0x00000003; random value
+dd 0x00000000; pad \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/suite/AutomatedIntegrationSuite.java b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/suite/AutomatedIntegrationSuite.java
index 74dd12243a2..619803cb3b5 100644
--- a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/suite/AutomatedIntegrationSuite.java
+++ b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/suite/AutomatedIntegrationSuite.java
@@ -38,6 +38,7 @@ import org.eclipse.cdt.utils.FindProgramLocationTest;
import org.eclipse.cdt.utils.StorableCdtVariablesTest;
import org.eclipse.cdt.utils.UNCPathConverterTest;
import org.eclipse.cdt.utils.WeakHashSetTest;
+import org.eclipse.cdt.utils.elf.ElfParserTest;
import junit.framework.Test;
import junit.framework.TestCase;
@@ -92,6 +93,7 @@ public class AutomatedIntegrationSuite extends TestSuite {
suite.addTest(ByteUtilsTest.suite());
suite.addTest(UNCPathConverterTest.suite());
suite.addTest(TestScopeOfBuildConfigResourceChangesPreference.suite());
+ suite.addTest(ElfParserTest.suite());
// Add in PDOM tests
suite.addTest(PDOMTests.suite());

Back to the top