Print this page
3638 ld confuses files with group sections and files that should lazy load


 874 #define FLG_IF_NODIRECT 0x00000100      /* object contains symbols that */
 875                                         /*      cannot be directly bound to */
 876 #define FLG_IF_LAZYLD   0x00000200      /* dependency should be lazy loaded */
 877 #define FLG_IF_GRPPRM   0x00000400      /* dependency establishes a group */
 878 #define FLG_IF_DISPPEND 0x00000800      /* displacement relocation done */
 879                                         /*      in the ld time. */
 880 #define FLG_IF_DISPDONE 0x00001000      /* displacement relocation done */
 881                                         /*      at the run time */
 882 #define FLG_IF_MAPFILE  0x00002000      /* file is a mapfile */
 883 #define FLG_IF_HSTRTAB  0x00004000      /* file has a string section */
 884 #define FLG_IF_FILEREF  0x00008000      /* file contains a section which */
 885                                         /*      is included in the output */
 886                                         /*      allocatable image */
 887 #define FLG_IF_GNUVER   0x00010000      /* file used GNU-style versioning */
 888 #define FLG_IF_ORDERED  0x00020000      /* ordered section processing */
 889                                         /*      required */
 890 #define FLG_IF_OTOSCAP  0x00040000      /* convert object capabilities to */
 891                                         /*      symbol capabilities */
 892 #define FLG_IF_DEFERRED 0x00080000      /* dependency is deferred */
 893 #define FLG_IF_RTLDINF  0x00100000      /* dependency has DT_SUNW_RTLTINF set */

 894 
 895 /*
 896  * Symbol states that require the generation of a DT_POSFLAG_1 .dynamic entry.
 897  */
 898 #define MSK_IF_POSFLAG1 (FLG_IF_LAZYLD | FLG_IF_GRPPRM | FLG_IF_DEFERRED)
 899 
 900 /*
 901  * Symbol states that require an associated Syminfo entry.
 902  */
 903 #define MSK_IF_SYMINFO  (FLG_IF_LAZYLD | FLG_IF_DIRECT | FLG_IF_DEFERRED)
 904 
 905 
 906 struct is_desc {                        /* input section descriptor */
 907         const char      *is_name;       /* original section name */
 908         const char      *is_sym_name;   /* NULL, or name string to use for */
 909                                         /*      related STT_SECTION symbols */
 910         Shdr            *is_shdr;       /* the elf section header */
 911         Ifl_desc        *is_file;       /* infile desc for this section */
 912         Os_desc         *is_osdesc;     /* new output section for this */
 913                                         /*      input section */


 917                                         /*      this is section that was kept */
 918         Word            is_scnndx;      /* original section index in file */
 919         Word            is_ordndx;      /* index for section.  Used to decide */
 920                                         /*      where to insert section when */
 921                                         /*      reordering sections */
 922         Word            is_keyident;    /* key for SHF_{ORDERED|LINK_ORDER} */
 923                                         /*      processing and ident used for */
 924                                         /*       placing/ordering sections */
 925         Word            is_flags;       /* Various flags */
 926 };
 927 
 928 #define FLG_IS_ORDERED  0x0001          /* this is a SHF_ORDERED section */
 929 #define FLG_IS_KEY      0x0002          /* section requires sort keys */
 930 #define FLG_IS_DISCARD  0x0004          /* section is to be discarded */
 931 #define FLG_IS_RELUPD   0x0008          /* symbol defined here may have moved */
 932 #define FLG_IS_SECTREF  0x0010          /* section has been referenced */
 933 #define FLG_IS_GDATADEF 0x0020          /* section contains global data sym */
 934 #define FLG_IS_EXTERNAL 0x0040          /* isp from a user file */
 935 #define FLG_IS_INSTRMRG 0x0080          /* Usable SHF_MERGE|SHF_STRINGS sec */
 936 #define FLG_IS_GNSTRMRG 0x0100          /* Generated mergeable string section */
 937 #define FLG_IS_GROUPS   0x0200          /* section has groups to process */
 938 #define FLG_IS_PLACE    0x0400          /* section requires to be placed */
 939 #define FLG_IS_COMDAT   0x0800          /* section is COMDAT */
 940 #define FLG_IS_EHFRAME  0x1000          /* section is .eh_frame */
 941 
 942 /*
 943  * Output sections contain lists of input sections that are assigned to them.
 944  * These items fall into 4 categories:
 945  *      BEFORE - Ordered sections that specify SHN_BEFORE, in input order.
 946  *      ORDERED - Ordered sections that are sorted using unsorted sections
 947  *              as the sort key.
 948  *      DEFAULT - Sections that are placed into the output section
 949  *              in input order.
 950  *      AFTER - Ordered sections that specify SHN_AFTER, in input order.
 951  */
 952 #define OS_ISD_BEFORE   0
 953 #define OS_ISD_ORDERED  1
 954 #define OS_ISD_DEFAULT  2
 955 #define OS_ISD_AFTER    3
 956 #define OS_ISD_NUM      4
 957 typedef APlist *os_isdecs_arr[OS_ISD_NUM];




 874 #define FLG_IF_NODIRECT 0x00000100      /* object contains symbols that */
 875                                         /*      cannot be directly bound to */
 876 #define FLG_IF_LAZYLD   0x00000200      /* dependency should be lazy loaded */
 877 #define FLG_IF_GRPPRM   0x00000400      /* dependency establishes a group */
 878 #define FLG_IF_DISPPEND 0x00000800      /* displacement relocation done */
 879                                         /*      in the ld time. */
 880 #define FLG_IF_DISPDONE 0x00001000      /* displacement relocation done */
 881                                         /*      at the run time */
 882 #define FLG_IF_MAPFILE  0x00002000      /* file is a mapfile */
 883 #define FLG_IF_HSTRTAB  0x00004000      /* file has a string section */
 884 #define FLG_IF_FILEREF  0x00008000      /* file contains a section which */
 885                                         /*      is included in the output */
 886                                         /*      allocatable image */
 887 #define FLG_IF_GNUVER   0x00010000      /* file used GNU-style versioning */
 888 #define FLG_IF_ORDERED  0x00020000      /* ordered section processing */
 889                                         /*      required */
 890 #define FLG_IF_OTOSCAP  0x00040000      /* convert object capabilities to */
 891                                         /*      symbol capabilities */
 892 #define FLG_IF_DEFERRED 0x00080000      /* dependency is deferred */
 893 #define FLG_IF_RTLDINF  0x00100000      /* dependency has DT_SUNW_RTLTINF set */
 894 #define FLG_IF_GROUPS   0x00200000      /* input file has groups to process */
 895 
 896 /*
 897  * Symbol states that require the generation of a DT_POSFLAG_1 .dynamic entry.
 898  */
 899 #define MSK_IF_POSFLAG1 (FLG_IF_LAZYLD | FLG_IF_GRPPRM | FLG_IF_DEFERRED)
 900 
 901 /*
 902  * Symbol states that require an associated Syminfo entry.
 903  */
 904 #define MSK_IF_SYMINFO  (FLG_IF_LAZYLD | FLG_IF_DIRECT | FLG_IF_DEFERRED)
 905 
 906 
 907 struct is_desc {                        /* input section descriptor */
 908         const char      *is_name;       /* original section name */
 909         const char      *is_sym_name;   /* NULL, or name string to use for */
 910                                         /*      related STT_SECTION symbols */
 911         Shdr            *is_shdr;       /* the elf section header */
 912         Ifl_desc        *is_file;       /* infile desc for this section */
 913         Os_desc         *is_osdesc;     /* new output section for this */
 914                                         /*      input section */


 918                                         /*      this is section that was kept */
 919         Word            is_scnndx;      /* original section index in file */
 920         Word            is_ordndx;      /* index for section.  Used to decide */
 921                                         /*      where to insert section when */
 922                                         /*      reordering sections */
 923         Word            is_keyident;    /* key for SHF_{ORDERED|LINK_ORDER} */
 924                                         /*      processing and ident used for */
 925                                         /*       placing/ordering sections */
 926         Word            is_flags;       /* Various flags */
 927 };
 928 
 929 #define FLG_IS_ORDERED  0x0001          /* this is a SHF_ORDERED section */
 930 #define FLG_IS_KEY      0x0002          /* section requires sort keys */
 931 #define FLG_IS_DISCARD  0x0004          /* section is to be discarded */
 932 #define FLG_IS_RELUPD   0x0008          /* symbol defined here may have moved */
 933 #define FLG_IS_SECTREF  0x0010          /* section has been referenced */
 934 #define FLG_IS_GDATADEF 0x0020          /* section contains global data sym */
 935 #define FLG_IS_EXTERNAL 0x0040          /* isp from a user file */
 936 #define FLG_IS_INSTRMRG 0x0080          /* Usable SHF_MERGE|SHF_STRINGS sec */
 937 #define FLG_IS_GNSTRMRG 0x0100          /* Generated mergeable string section */
 938 
 939 #define FLG_IS_PLACE    0x0400          /* section requires to be placed */
 940 #define FLG_IS_COMDAT   0x0800          /* section is COMDAT */
 941 #define FLG_IS_EHFRAME  0x1000          /* section is .eh_frame */
 942 
 943 /*
 944  * Output sections contain lists of input sections that are assigned to them.
 945  * These items fall into 4 categories:
 946  *      BEFORE - Ordered sections that specify SHN_BEFORE, in input order.
 947  *      ORDERED - Ordered sections that are sorted using unsorted sections
 948  *              as the sort key.
 949  *      DEFAULT - Sections that are placed into the output section
 950  *              in input order.
 951  *      AFTER - Ordered sections that specify SHN_AFTER, in input order.
 952  */
 953 #define OS_ISD_BEFORE   0
 954 #define OS_ISD_ORDERED  1
 955 #define OS_ISD_DEFAULT  2
 956 #define OS_ISD_AFTER    3
 957 #define OS_ISD_NUM      4
 958 typedef APlist *os_isdecs_arr[OS_ISD_NUM];