NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: toolchain/43856: some executables have all loaded sections executable
The following reply was made to PR toolchain/43856; it has been noted by GNATS.
From: Martin Husemann <martin%duskware.de@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: toolchain/43856: some executables have all loaded sections
executable
Date: Fri, 10 Sep 2010 08:55:37 +0200
More data and some correction: "some" binary basically means "all binaries",
it just wasn't that obvious because not everything uses break()/sbreak() and
therefore didn't fail during recent exec_elf.c changes.
More data below.
As long as there is no non-executable PLT format for some archs, should we
fix the default linker scripts to move .plt and .data into different segments?
Martin
Here is an arbitrary example:
readelf -l /usr/obj/bin/ls/ls
Elf file type is EXEC (Executable file)
Entry point 0x101200
There are 6 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
PHDR 0x0000000000000040 0x0000000000100040 0x0000000000100040
0x0000000000000150 0x0000000000000150 R E 8
INTERP 0x0000000000000190 0x0000000000100190 0x0000000000100190
0x0000000000000013 0x0000000000000013 R 1
[Requesting program interpreter: /libexec/ld.elf_so]
LOAD 0x0000000000000000 0x0000000000100000 0x0000000000100000
0x000000000000485c 0x000000000000485c R E 100000
LOAD 0x0000000000004860 0x0000000000204860 0x0000000000204860
0x00000000000009dc 0x0000000000000ca0 RWE 100000
DYNAMIC 0x0000000000004888 0x0000000000204888 0x0000000000204888
0x00000000000001a0 0x00000000000001a0 RW 8
NOTE 0x00000000000001a4 0x00000000001001a4 0x00000000001001a4
0x000000000000002c 0x000000000000002c R 4
Section to Segment mapping:
Segment Sections...
00
01 .interp
02 .interp .note.netbsd.ident .note.netbsd.pax .hash .dynsym .dynstr
.rela.dyn .rela.plt .init .text .fini .rodata .eh_frame
03 .ctors .dtors .jcr .dynamic .got .plt .data .bss
04 .dynamic
05 .note.netbsd.ident .note.netbsd.pax
And the link map:
# link ls/ls
/usr/tools/bin/sparc64--netbsd-gcc -B//usr/lib/ -B//usr/lib/ -Wl,-nostdlib
-Wl,--print-map -Wl,--fatal-warnings -o ls cmp.o ls.o main.o print.o
util.o -lutil -L//usr/lib -Wl,-dynamic-linker=/libexec/ld.elf_so
-Wl,-rpath-link,//lib -R/lib -L//lib -Wl,-rpath-link,//usr/lib -L//usr/lib
Allocating common symbols
Common symbol size file
f_size 0x4 ls.o
f_nonprint 0x4 ls.o
f_grouponly 0x4 ls.o
f_column 0x4 ls.o
f_listdir 0x4 ls.o
f_whiteout 0x4 ls.o
f_nosort 0x4 ls.o
f_octal_escape 0x4 ls.o
f_longform 0x4 ls.o
f_type 0x4 ls.o
f_singlecol 0x4 ls.o
f_typedir 0x4 ls.o
f_recursive 0x4 ls.o
blocksize 0x8 ls.o
f_numericonly 0x4 ls.o
f_sectime 0x4 ls.o
f_stream 0x4 ls.o
environ 0x8 //usr/lib/crt0.o
f_listdot 0x4 ls.o
f_accesstime 0x4 ls.o
f_flags 0x4 ls.o
f_octal 0x4 ls.o
f_humanize 0x4 ls.o
f_columnacross 0x4 ls.o
f_reversesort 0x4 ls.o
f_inode 0x4 ls.o
f_statustime 0x4 ls.o
Memory Configuration
Name Origin Length Attributes
*default* 0x0000000000000000 0xffffffffffffffff
Linker script and memory map
LOAD //usr/lib/crt0.o
LOAD //usr/lib/crti.o
LOAD //usr/lib/crtbegin.o
LOAD cmp.o
LOAD ls.o
LOAD main.o
LOAD print.o
LOAD util.o
LOAD //usr/lib/libutil.so
LOAD //usr/lib/libgcc.a
LOAD //usr/lib/libgcc_eh.a
LOAD //usr/lib/libc.so
LOAD //usr/lib/libgcc.a
LOAD //usr/lib/libgcc_eh.a
LOAD //usr/lib/libc.so
LOAD //usr/lib/crtend.o
LOAD //usr/lib/crtn.o
0x0000000000100000 PROVIDE (__executable_start,
0x100000)
0x0000000000100190 . = (0x100000 +
SIZEOF_HEADERS)
.interp 0x0000000000100190 0x13
*(.interp)
.interp 0x0000000000100190 0x13 //usr/lib/crt0.o
.note.netbsd.ident
0x00000000001001a4 0x18
.note.netbsd.ident
0x00000000001001a4 0x18 //usr/lib/crti.o
.note.netbsd.pax
0x00000000001001bc 0x14
.note.netbsd.pax
0x00000000001001bc 0x14 //usr/lib/crti.o
.note.gnu.build-id
*(.note.gnu.build-id)
.hash 0x00000000001001d0 0x1a4
*(.hash)
.hash 0x00000000001001d0 0x1a4 //usr/lib/crt0.o
.gnu.hash
*(.gnu.hash)
.dynsym 0x0000000000100378 0x630
*(.dynsym)
.dynsym 0x0000000000100378 0x630 //usr/lib/crt0.o
.dynstr 0x00000000001009a8 0x267
*(.dynstr)
.dynstr 0x00000000001009a8 0x267 //usr/lib/crt0.o
.gnu.version 0x0000000000100c10 0x0 load address 0x0000000000100c0f
*(.gnu.version)
.gnu.version 0x0000000000000000 0x0 //usr/lib/crt0.o
.gnu.version_d 0x0000000000100c10 0x0 load address 0x0000000000100c0f
*(.gnu.version_d)
.gnu.version_d
0x0000000000000000 0x0 //usr/lib/crt0.o
.gnu.version_r 0x0000000000100c10 0x0 load address 0x0000000000100c0f
*(.gnu.version_r)
.gnu.version_r
0x0000000000000000 0x0 //usr/lib/crt0.o
.rel.dyn
*(.rel.init)
*(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
*(.rel.fini)
*(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
*(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
*(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
*(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
*(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
*(.rel.ctors)
*(.rel.dtors)
*(.rel.got)
*(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
.rela.dyn 0x0000000000100c10 0xf0
*(.rela.init)
*(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
.rela.text 0x0000000000000000 0x0 //usr/lib/crt0.o
*(.rela.fini)
*(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
*(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
*(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
*(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
*(.rela.ctors)
*(.rela.dtors)
*(.rela.got)
.rela.got 0x0000000000100c10 0xa8 //usr/lib/crt0.o
*(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
.rela.bss 0x0000000000100cb8 0x48 //usr/lib/crt0.o
.rel.plt
*(.rel.plt)
.rela.plt 0x0000000000100d00 0x4e0
*(.rela.plt)
.rela.plt 0x0000000000100d00 0x4e0 //usr/lib/crt0.o
.init 0x00000000001011e0 0x1c
*(.init)
.init 0x00000000001011e0 0x4 //usr/lib/crti.o
0x00000000001011e0 _init
.init 0x00000000001011e4 0x8 //usr/lib/crtbegin.o
.init 0x00000000001011ec 0x8 //usr/lib/crtend.o
.init 0x00000000001011f4 0x8 //usr/lib/crtn.o
.text 0x0000000000101200 0x3440
*(.text .stub .text.* .gnu.linkonce.t.*)
.text 0x0000000000101200 0x240 //usr/lib/crt0.o
0x0000000000101200 _start
0x00000000001012e0 ___start
0x0000000000101240 _rtld_setup
0x0000000000101200 __start
.text 0x0000000000101440 0x0 //usr/lib/crti.o
.text 0x0000000000101440 0x180 //usr/lib/crtbegin.o
.text 0x00000000001015c0 0x300 cmp.o
0x0000000000101740 namecmp
0x0000000000101760 sizecmp
0x0000000000101680 revacccmp
0x0000000000101620 revstatcmp
0x0000000000101800 acccmp
0x00000000001017a0 statcmp
0x00000000001015e0 revsizecmp
0x0000000000101860 modcmp
0x00000000001015c0 revnamecmp
0x00000000001016e0 revmodcmp
.text 0x00000000001018c0 0x12c0 ls.o
0x0000000000102380 ls_main
.text 0x0000000000102b80 0x20 main.o
0x0000000000102b80 main
.text 0x0000000000102ba0 0x16e0 print.o
0x0000000000103a80 printstream
0x00000000001034e0 printlong
0x0000000000103100 printscol
0x0000000000103cc0 printacol
0x0000000000103f20 printcol
.text 0x0000000000104280 0x320 util.o
0x00000000001044e0 safe_print
0x0000000000104380 printescaped
0x0000000000104280 usage
.text 0x00000000001045a0 0xa0 //usr/lib/crtend.o
.text 0x0000000000104640 0x0 //usr/lib/crtn.o
*(.gnu.warning)
.fini 0x0000000000104640 0x14
*(.fini)
.fini 0x0000000000104640 0x4 //usr/lib/crti.o
0x0000000000104640 _fini
.fini 0x0000000000104644 0x8 //usr/lib/crtbegin.o
.fini 0x000000000010464c 0x8 //usr/lib/crtn.o
0x0000000000104654 PROVIDE (__etext, .)
0x0000000000104654 PROVIDE (_etext, .)
0x0000000000104654 PROVIDE (etext, .)
.rodata 0x0000000000104658 0x200
*(.rodata .rodata.* .gnu.linkonce.r.*)
.rodata.str1.8
0x0000000000104658 0x49 //usr/lib/crt0.o
0x58 (size before relaxing)
*fill* 0x00000000001046a1 0x7 00
.rodata.str1.8
0x00000000001046a8 0x81 ls.o
0x90 (size before relaxing)
.rodata 0x0000000000104729 0x0 ls.o
*fill* 0x0000000000104729 0x7 00
.rodata.str1.8
0x0000000000104730 0xbd print.o
0xc8 (size before relaxing)
*fill* 0x00000000001047ed 0x3 00
.rodata.str1.8
0x00000000001047f0 0x68 util.o
0x70 (size before relaxing)
.rodata1
*(.rodata1)
.eh_frame_hdr
*(.eh_frame_hdr)
.eh_frame 0x0000000000104858 0x4
*(.eh_frame)
.eh_frame 0x0000000000104858 0x0 //usr/lib/crtbegin.o
.eh_frame 0x0000000000104858 0x4 //usr/lib/crtend.o
.gcc_except_table
*(.gcc_except_table .gcc_except_table.*)
0x000000000010485c . = (ALIGN (0x100000) -
((0x100000 - .) & 0xfffff))
0x000000000020485c . = (0x100000
DATA_SEGMENT_ALIGN 0x2000)
.eh_frame
*(.eh_frame)
.gcc_except_table
*(.gcc_except_table .gcc_except_table.*)
.tdata
*(.tdata .tdata.* .gnu.linkonce.td.*)
.tbss
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon)
.preinit_array 0x000000000020485c 0x0
0x000000000020485c PROVIDE
(__preinit_array_start, .)
*(.preinit_array)
0x000000000020485c PROVIDE
(__preinit_array_end, .)
.init_array 0x000000000020485c 0x0
0x000000000020485c PROVIDE (__init_array_start,
.)
*(SORT(.init_array.*))
*(.init_array)
0x000000000020485c PROVIDE (__init_array_end, .)
.fini_array 0x000000000020485c 0x0
0x000000000020485c PROVIDE (__fini_array_start,
.)
*(.fini_array)
*(SORT(.fini_array.*))
0x000000000020485c PROVIDE (__fini_array_end, .)
.ctors 0x0000000000204860 0x10
*crtbegin.o(.ctors)
.ctors 0x0000000000204860 0x8 //usr/lib/crtbegin.o
*crtbegin?.o(.ctors)
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
*(SORT(.ctors.*))
*(.ctors)
.ctors 0x0000000000204868 0x8 //usr/lib/crtend.o
.dtors 0x0000000000204870 0x10
*crtbegin.o(.dtors)
.dtors 0x0000000000204870 0x8 //usr/lib/crtbegin.o
*crtbegin?.o(.dtors)
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
*(SORT(.dtors.*))
*(.dtors)
.dtors 0x0000000000204878 0x8 //usr/lib/crtend.o
.jcr 0x0000000000204880 0x8
*(.jcr)
.jcr 0x0000000000204880 0x0 //usr/lib/crtbegin.o
.jcr 0x0000000000204880 0x8 //usr/lib/crtend.o
.data.rel.ro
*(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*)
*(.data.rel.ro* .gnu.linkonce.d.rel.ro.*)
.dynamic 0x0000000000204888 0x1a0
*(.dynamic)
.dynamic 0x0000000000204888 0x1a0 //usr/lib/crt0.o
0x0000000000204888 _DYNAMIC
0x0000000000204a28 . = (.
DATA_SEGMENT_RELRO_END 0x0)
.got 0x0000000000204a28 0x90
*(.got.plt)
*(.got)
.got 0x0000000000204a28 0x90 //usr/lib/crt0.o
0x0000000000204a28 _GLOBAL_OFFSET_TABLE_
.plt 0x0000000000204b00 0x700
*(.plt)
.plt 0x0000000000204b00 0x700 //usr/lib/crt0.o
0x0000000000204b80 getbsize
0x0000000000204ba0 errx
0x0000000000204be0 user_from_uid
0x0000000000204c00 getenv
0x0000000000204c20 fwrite
0x0000000000204c40 realloc
0x0000000000204c60 group_from_gid
0x0000000000204c80 readlink
0x0000000000204ca0 __ctime50
0x0000000000204cc0 __fts_read60
0x0000000000204ce0 flags_to_string
0x0000000000204d00 __time50
0x0000000000204d20 malloc
0x0000000000204d40 __fts_set60
0x0000000000204d60 ioctl
0x0000000000204d80 strlen
0x0000000000204da0 snprintf
0x0000000000204dc0 atexit
0x0000000000204de0 strmode
0x0000000000204e00 wcwidth
0x0000000000204e20 __fts_close60
0x0000000000204e40 warnx
0x0000000000204e60 mbrtowc
0x0000000000204e80 isatty
0x0000000000204ea0 iswprint
0x0000000000204ec0 err
0x0000000000204ee0 humanize_number
0x0000000000204f00 memset
0x0000000000204f20 __setlocale50
0x0000000000204f40 wcrtomb
0x0000000000204f60 getuid
0x0000000000204f80 fprintf
0x0000000000204fa0 getprogname
0x0000000000204fc0 __syscall
0x0000000000204fe0 __swbuf
0x0000000000205000 exit
0x0000000000205020 setprogname
0x0000000000205040 __fts_open60
0x0000000000205060 strcmp
0x0000000000205080 getopt
0x00000000002050a0 strvis
0x00000000002050c0 __errno
0x00000000002050e0 free
0x0000000000205100 atoi
0x0000000000204b00 _PROCEDURE_LINKAGE_TABLE_
0x0000000000205120 strerror
0x0000000000205140 printf
0x0000000000205160 warn
0x00000000002051a0 strcpy
0x00000000002051e0 __fts_children60
.data 0x0000000000205200 0x3c
*(.data .data.* .gnu.linkonce.d.*)
.data 0x0000000000205200 0x0 //usr/lib/crt0.o
.data.rel.local
0x0000000000205200 0x8 //usr/lib/crt0.o
0x0000000000205200 __progname
.data 0x0000000000205208 0x0 //usr/lib/crti.o
.data 0x0000000000205208 0x8 //usr/lib/crtbegin.o
0x0000000000205208 __dso_handle
.data.rel.local
0x0000000000205210 0x8 //usr/lib/crtbegin.o
.data 0x0000000000205218 0x0 cmp.o
.data 0x0000000000205218 0x20 ls.o
0x0000000000205218 termwidth
.data 0x0000000000205238 0x0 main.o
.data 0x0000000000205238 0x4 print.o
.data 0x000000000020523c 0x0 util.o
.data 0x000000000020523c 0x0 //usr/lib/crtend.o
.data 0x000000000020523c 0x0 //usr/lib/crtn.o
.data1
*(.data1)
0x000000000020523c _edata = .
0x000000000020523c PROVIDE (edata, .)
0x000000000020523c __bss_start = .
.bss 0x0000000000205240 0x2c0
*(.dynbss)
.dynbss 0x0000000000205240 0x1d4 //usr/lib/crt0.o
0x0000000000205240 __sF
0x0000000000205408 __mb_cur_max
0x0000000000205410 optind
*(.bss .bss.* .gnu.linkonce.b.*)
*fill* 0x0000000000205414 0x4 00
.bss 0x0000000000205418 0x8 //usr/lib/crt0.o
0x0000000000205418 __ps_strings
.bss 0x0000000000205420 0x0 //usr/lib/crti.o
.bss 0x0000000000205420 0x38 //usr/lib/crtbegin.o
.bss 0x0000000000205458 0x0 cmp.o
.bss 0x0000000000205458 0x20 ls.o
0x0000000000205458 sortkey
0x000000000020545c rval
.bss 0x0000000000205478 0x0 main.o
.bss 0x0000000000205478 0x10 print.o
.bss 0x0000000000205488 0x0 util.o
.bss 0x0000000000205488 0x0 //usr/lib/crtend.o
.bss 0x0000000000205488 0x0 //usr/lib/crtn.o
*(COMMON)
COMMON 0x0000000000205488 0x8 //usr/lib/crt0.o
0x0000000000205488 environ
COMMON 0x0000000000205490 0x70 ls.o
0x0000000000205490 f_size
0x0000000000205494 f_nonprint
0x0000000000205498 f_grouponly
0x000000000020549c f_column
0x00000000002054a0 f_listdir
0x00000000002054a4 f_whiteout
0x00000000002054a8 f_nosort
0x00000000002054ac f_octal_escape
0x00000000002054b0 f_longform
0x00000000002054b4 f_type
0x00000000002054b8 f_singlecol
0x00000000002054bc f_typedir
0x00000000002054c0 f_recursive
0x00000000002054c8 blocksize
0x00000000002054d0 f_numericonly
0x00000000002054d4 f_sectime
0x00000000002054d8 f_stream
0x00000000002054dc f_listdot
0x00000000002054e0 f_accesstime
0x00000000002054e4 f_flags
0x00000000002054e8 f_octal
0x00000000002054ec f_humanize
0x00000000002054f0 f_columnacross
0x00000000002054f4 f_reversesort
0x00000000002054f8 f_inode
0x00000000002054fc f_statustime
0x0000000000205500 . = ALIGN ((. !=
0x0)?0x8:0x1)
0x0000000000205500 . = ALIGN (0x8)
0x0000000000205500 . = ALIGN (0x8)
0x0000000000205500 _end = .
0x0000000000205500 PROVIDE (end, .)
0x0000000000205500 . = DATA_SEGMENT_END (.)
.stab
*(.stab)
.stabstr
*(.stabstr)
.stab.excl
*(.stab.excl)
.stab.exclstr
*(.stab.exclstr)
.stab.index
*(.stab.index)
.stab.indexstr
*(.stab.indexstr)
.comment 0x0000000000000000 0x26c
*(.comment)
.comment 0x0000000000000000 0x3e //usr/lib/crt0.o
.comment 0x000000000000003e 0x3e //usr/lib/crti.o
.comment 0x000000000000007c 0x3e //usr/lib/crtbegin.o
.comment 0x00000000000000ba 0x3e cmp.o
.comment 0x00000000000000f8 0x3e ls.o
.comment 0x0000000000000136 0x3e main.o
.comment 0x0000000000000174 0x3e print.o
.comment 0x00000000000001b2 0x3e util.o
.comment 0x00000000000001f0 0x3e //usr/lib/crtend.o
.comment 0x000000000000022e 0x3e //usr/lib/crtn.o
.debug
*(.debug)
.line
*(.line)
.debug_srcinfo
*(.debug_srcinfo)
.debug_sfnames
*(.debug_sfnames)
.debug_aranges
*(.debug_aranges)
.debug_pubnames
*(.debug_pubnames)
.debug_info
*(.debug_info .gnu.linkonce.wi.*)
.debug_abbrev
*(.debug_abbrev)
.debug_line
*(.debug_line)
.debug_frame
*(.debug_frame)
.debug_str
*(.debug_str)
.debug_loc
*(.debug_loc)
.debug_macinfo
*(.debug_macinfo)
.debug_weaknames
*(.debug_weaknames)
.debug_funcnames
*(.debug_funcnames)
.debug_typenames
*(.debug_typenames)
.debug_varnames
*(.debug_varnames)
.debug_pubtypes
*(.debug_pubtypes)
.debug_ranges
*(.debug_ranges)
.gnu.attributes
*(.gnu.attributes)
/DISCARD/
*(.note.GNU-stack)
*(.gnu_debuglink)
OUTPUT(ls elf64-sparc)
.ident 0x0000000000000000 0x145
.ident 0x0000000000000000 0x37 //usr/lib/crt0.o
.ident 0x0000000000000037 0x34 cmp.o
.ident 0x000000000000006b 0x35 ls.o
.ident 0x00000000000000a0 0x37 main.o
.ident 0x00000000000000d7 0x38 print.o
.ident 0x000000000000010f 0x36 util.o
.copyright 0x0000000000000000 0x67
.copyright 0x0000000000000000 0x67 ls.o
Home |
Main Index |
Thread Index |
Old Index