File tree Expand file tree Collapse file tree 5 files changed +61
-2
lines changed Expand file tree Collapse file tree 5 files changed +61
-2
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ AM_INIT_AUTOMAKE([1.11.1 -Wall -Werror dist-bzip2 foreign color-tests parallel-t
66
77AM_PROG_CC_C_O
88AC_PROG_CXX
9+ AM_PROG_AS
910
1011DEFAULT_PAGESIZE=auto
1112AC_ARG_WITH ( [ page-size] ,
Original file line number Diff line number Diff line change 11LIBS =
22
3- check_PROGRAMS = simple main main-scoped big-dynstr no-rpath
3+ check_PROGRAMS = simple main main-scoped big-dynstr no-rpath contiguous_note_sections
44
55no_rpath_arch_TESTS = \
66 no-rpath-amd64.sh \
@@ -27,7 +27,8 @@ src_TESTS = \
2727 output-flag.sh \
2828 no-rpath-pie-powerpc.sh \
2929 build-id.sh \
30- invalid-elf.sh
30+ invalid-elf.sh \
31+ contiguous_note_sections.sh
3132
3233build_TESTS = \
3334 $(no_rpath_arch_TESTS )
@@ -106,3 +107,7 @@ libsimple_so_LDFLAGS = $(LDFLAGS_sharedlib)
106107no_rpath_SOURCES = no-rpath.c
107108# no -fpic for no-rpath.o
108109no_rpath_CFLAGS =
110+
111+ contiguous_note_sections_SOURCES = contiguous_note_sections.s contiguous_note_sections.ld
112+ contiguous_note_sections_LDFLAGS = -nostdlib -T contiguous_note_sections.ld
113+ contiguous_note_sections_CFLAGS = -pie
Original file line number Diff line number Diff line change 1+ PHDRS
2+ {
3+ headers PT_PHDR PHDRS ;
4+ notes PT_NOTE;
5+ text PT_LOAD FILEHDR PHDRS ;
6+ data PT_LOAD ;
7+ interp PT_INTERP ;
8+ dynamic PT_DYNAMIC ;
9+ }
10+
11+ SECTIONS
12+ {
13+ . = SIZEOF_HEADERS ;
14+ . = ALIGN (4 );
15+
16+ .note.my-section0 : { *(.note .my -section0) } :notes :text
17+ .note.my-section1 : { *(.note .my -section1) } :notes :text
18+
19+ .interp : { *(.interp ) } :text :interp
20+ .text : { *(.text ) } :text
21+ .rodata : { *(.rodata ) } /* defaults to :text */
22+
23+ .data : { *(.data ) } :data
24+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Testcase for error:
3+ * patchelf: cannot normalize PT_NOTE segment: non-contiguous SHT_NOTE sections
4+ */
5+ .section ".note.my-section0" , "a" , @note
6+ .align 4
7+ .long 1f - 0f /* name length (not including padding) */
8+ .long 3f - 2f /* desc length (not including padding) */
9+ .long 1 /* type = NT_VERSION */
10+ 0: .asciz "my-version-12345" /* name */
11+ 1: .align 4
12+ 2: .long 1 /* desc - toolchain version number, 32-bit LE */
13+ 3: .align 4
14+
15+ .section ".note.my-section1" , "a" , @note
16+ .align 8
17+ .long 1f - 0f /* name length (not including padding) */
18+ .long 3f - 2f /* desc length (not including padding) */
19+ .long 1 /* type = NT_VERSION */
20+ 0: .asciz "my-version-1" /* name */
21+ 1: .align 4
22+ 2: .long 1 /* desc - toolchain version number, 32-bit LE */
23+ 3: .align 4
Original file line number Diff line number Diff line change 1+ #! /bin/sh -e
2+
3+ # Running --set-interpreter on this binary should not produce the following
4+ # error:
5+ # patchelf: cannot normalize PT_NOTE segment: non-contiguous SHT_NOTE sections
6+ ../src/patchelf --set-interpreter ld-linux-x86-64.so.2 contiguous_note_sections
You can’t perform that action at this time.
0 commit comments