Changeset 47b2d7e3 in mainline


Ignore:
Timestamp:
2018-03-30T21:35:15Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1433ecda
Parents:
5b8f731
Message:

Always load ELF headers as part of the text segment.

This forces us to align the start of the text segment to its
declared alignment, otherwise the linker would be forced to allocate
address 0, which the kernel doesn't allow.

Instead of setting the start differently based on each platform's
declared text alignment, set it always to 0x400000 (4 MB),
which is greater than the largest alignment among the currently
supported platforms (amd64, 2MB alignment), and also aligns with
large pages on all platforms that support them.

Location:
uspace/lib/c/arch
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/arch/abs32le/_link.ld.in

    r5b8f731 r47b2d7e3  
    55#ifdef LOADER
    66        interp PT_INTERP;
     7#endif
    78        text PT_LOAD FILEHDR PHDRS FLAGS(5);
    8 #else
    9         text PT_LOAD FLAGS(5);
    10 #endif
    119        data PT_LOAD FLAGS(6);
    1210}
     
    1412SECTIONS {
    1513#ifdef LOADER
    16         . = 0x70001000 + SIZEOF_HEADERS;
     14        . = SEGMENT_START("text-segment", 0x70400000);
    1715#else
    18         . = 0x1000 + SIZEOF_HEADERS;
     16        . = SEGMENT_START("text-segment", 0x400000);
    1917#endif
     18#ifndef SHLIB
     19        PROVIDE (__executable_start = .);
     20#endif
     21        . = . + SIZEOF_HEADERS;
    2022
    2123        .text : {
  • uspace/lib/c/arch/amd64/_link.ld.in

    r5b8f731 r47b2d7e3  
    55#ifdef LOADER
    66        interp PT_INTERP;
     7#endif
    78        text PT_LOAD FILEHDR PHDRS FLAGS(5);
    8 #else
    9         text PT_LOAD FLAGS(5);
    10 #endif
    119        data PT_LOAD FLAGS(6);
    1210        debug PT_NOTE;
     
    1513SECTIONS {
    1614#ifdef LOADER
    17         . = 0x70001000 + SIZEOF_HEADERS;
     15        . = SEGMENT_START("text-segment", 0x70400000);
    1816#else
    19         . = 0x1000 + SIZEOF_HEADERS;
     17        . = SEGMENT_START("text-segment", 0x400000);
    2018#endif
     19#ifndef SHLIB
     20        PROVIDE (__executable_start = .);
     21#endif
     22        . = . + SIZEOF_HEADERS;
    2123
    2224        .init : {
  • uspace/lib/c/arch/arm32/_link.ld.in

    r5b8f731 r47b2d7e3  
    55#ifdef LOADER
    66        interp PT_INTERP;
     7#endif
    78        text PT_LOAD FILEHDR PHDRS FLAGS(5);
    8 #else
    9         text PT_LOAD FLAGS(5);
    10 #endif
    119        data PT_LOAD FLAGS(6);
    1210}
     
    1412SECTIONS {
    1513#ifdef LOADER
    16         . = 0x70001000 + SIZEOF_HEADERS;
     14        . = SEGMENT_START("text-segment", 0x70400000);
    1715#else
    18         . = 0x1000 + SIZEOF_HEADERS;
     16        . = SEGMENT_START("text-segment", 0x400000);
    1917#endif
     18#ifndef SHLIB
     19        PROVIDE (__executable_start = .);
     20#endif
     21        . = . + SIZEOF_HEADERS;
    2022
    2123        .init : {
  • uspace/lib/c/arch/ia32/_link.ld.in

    r5b8f731 r47b2d7e3  
    77#if defined(LOADER) || defined(DLEXE)
    88        interp PT_INTERP;
     9#endif
    910        text PT_LOAD FILEHDR PHDRS FLAGS(5);
    10 #else
    11         text PT_LOAD FLAGS(5);
    12 #endif
    1311        data PT_LOAD FLAGS(6);
    1412        tls PT_TLS;
     
    2119SECTIONS {
    2220#ifdef LOADER
    23         . = 0x70001000 + SIZEOF_HEADERS;
     21        . = SEGMENT_START("text-segment", 0x70400000);
    2422#else
    25         . = 0x1000 + SIZEOF_HEADERS;
     23        . = SEGMENT_START("text-segment", 0x400000);
    2624#endif
     25#ifndef SHLIB
     26        PROVIDE (__executable_start = .);
     27#endif
     28        . = . + SIZEOF_HEADERS;
    2729
    2830        .init : {
  • uspace/lib/c/arch/ia64/_link.ld.in

    r5b8f731 r47b2d7e3  
    55#ifdef LOADER
    66        interp PT_INTERP;
    7         text PT_LOAD FLAGS(5);
    8 #else
    9         text PT_LOAD FLAGS(5);
    107#endif
     8        text PT_LOAD FILEHDR PHDRS FLAGS(5);
    119        data PT_LOAD FLAGS(6);
    1210}
     
    1412SECTIONS {
    1513#ifdef LOADER
    16         . = 0x800000000 + SIZEOF_HEADERS;
     14        . = SEGMENT_START("text-segment", 0x8000000000);
    1715#else
    18         . = 0x4000 + SIZEOF_HEADERS;
     16        . = SEGMENT_START("text-segment", 0x400000);
    1917#endif
     18#ifndef SHLIB
     19        PROVIDE (__executable_start = .);
     20#endif
     21        . = . + SIZEOF_HEADERS;
    2022
    2123        /* Workaround proper alignment of the .init section */
  • uspace/lib/c/arch/mips32/_link.ld.in

    r5b8f731 r47b2d7e3  
    55#ifdef LOADER
    66        interp PT_INTERP;
     7#endif
    78        text PT_LOAD FILEHDR PHDRS FLAGS(5);
    8 #else
    9         text PT_LOAD FLAGS(5);
    10 #endif
    119        data PT_LOAD FLAGS(6);
    1210}
     
    1412SECTIONS {
    1513#ifdef LOADER
    16         . = 0x70004000 + SIZEOF_HEADERS;
     14        . = SEGMENT_START("text-segment", 0x70400000);
    1715#else
    18         . = 0x4000 + SIZEOF_HEADERS;
     16        . = SEGMENT_START("text-segment", 0x400000);
    1917#endif
     18#ifndef SHLIB
     19        PROVIDE (__executable_start = .);
     20#endif
     21        . = . + SIZEOF_HEADERS;
    2022
    2123        .init : {
  • uspace/lib/c/arch/ppc32/_link.ld.in

    r5b8f731 r47b2d7e3  
    55#ifdef LOADER
    66        interp PT_INTERP;
     7#endif
    78        text PT_LOAD FILEHDR PHDRS FLAGS(5);
    8 #else
    9         text PT_LOAD FLAGS(5);
    10 #endif
    119        data PT_LOAD FLAGS(6);
    1210        debug PT_NOTE;
     
    1513SECTIONS {
    1614#ifdef LOADER
    17         . = 0x70001000 + SIZEOF_HEADERS;
     15        . = SEGMENT_START("text-segment", 0x70400000);
    1816#else
    19         . = 0x1000 + SIZEOF_HEADERS;
     17        . = SEGMENT_START("text-segment", 0x400000);
    2018#endif
     19#ifndef SHLIB
     20        PROVIDE (__executable_start = .);
     21#endif
     22        . = . + SIZEOF_HEADERS;
    2123
    2224        .init : {
  • uspace/lib/c/arch/riscv64/_link.ld.in

    r5b8f731 r47b2d7e3  
    55#ifdef LOADER
    66        interp PT_INTERP;
     7#endif
    78        text PT_LOAD FILEHDR PHDRS FLAGS(5);
    8 #else
    9         text PT_LOAD FLAGS(5);
    10 #endif
    119        data PT_LOAD FLAGS(6);
    1210        debug PT_NOTE;
     
    1513SECTIONS {
    1614#ifdef LOADER
    17         . = 0x70001000 + SIZEOF_HEADERS;
     15        . = SEGMENT_START("text-segment", 0x70400000);
    1816#else
    19         . = 0x1000 + SIZEOF_HEADERS;
     17        . = SEGMENT_START("text-segment", 0x400000);
    2018#endif
     19#ifndef SHLIB
     20        PROVIDE (__executable_start = .);
     21#endif
     22        . = . + SIZEOF_HEADERS;
    2123
    2224        .text : {
  • uspace/lib/c/arch/sparc64/_link.ld.in

    r5b8f731 r47b2d7e3  
    55#ifdef LOADER
    66        interp PT_INTERP;
     7#endif
    78        text PT_LOAD FILEHDR PHDRS FLAGS(5);
    8 #else
    9         text PT_LOAD FLAGS(5);
    10 #endif
    119        data PT_LOAD FLAGS(6);
    1210        debug PT_NOTE;
     
    1513SECTIONS {
    1614#ifdef LOADER
    17         . = 0x70004000 + SIZEOF_HEADERS;
     15        . = SEGMENT_START("text-segment", 0x70400000);
    1816#else
    19         . = 0x4000 + SIZEOF_HEADERS;
     17        . = SEGMENT_START("text-segment", 0x400000);
    2018#endif
     19#ifndef SHLIB
     20        PROVIDE (__executable_start = .);
     21#endif
     22        . = . + SIZEOF_HEADERS;
    2123
    2224        .init : {
Note: See TracChangeset for help on using the changeset viewer.