Print this page
ld: implement -ztype and rework option parsing


1526 
1527         /*
1528          * Determine whether this symbol should be bound locally or not.
1529          * Symbols are bound locally if one of the following is true:
1530          *
1531          *  -   the symbol is of type STB_LOCAL.
1532          *
1533          *  -   the output image is not a relocatable object and the relocation
1534          *      is relative to the .got.
1535          *
1536          *  -   the section being relocated is of type SHT_SUNW_dof.  These
1537          *      sections must be bound to the functions in the containing
1538          *      object and can not be interposed upon.
1539          *
1540          *  -   the symbol has been reduced (scoped to a local or symbolic) and
1541          *      reductions are being processed.
1542          *
1543          *  -   the -Bsymbolic flag is in use when building a shared object,
1544          *      and the symbol hasn't explicitly been defined as nodirect.
1545          *
1546          *  -   an executable (fixed address) is being created, and the symbol
1547          *      is defined in the executable.
1548          *
1549          *  -   the relocation is against a segment which will not be loaded
1550          *      into memory.  In this case, the relocation must be resolved
1551          *      now, as ld.so.1 can not process relocations against unmapped
1552          *      segments.
1553          */
1554         local = FALSE;
1555         if (ELF_ST_BIND(sdp->sd_sym->st_info) == STB_LOCAL) {
1556                 local = TRUE;
1557         } else if (!(reld->rel_flags & FLG_REL_LOAD)) {
1558                 local = TRUE;
1559         } else if (sdp->sd_sym->st_shndx != SHN_UNDEF) {
1560                 if (reld->rel_isdesc &&
1561                     reld->rel_isdesc->is_shdr->sh_type == SHT_SUNW_dof) {
1562                         local = TRUE;
1563                 } else if (!(flags & FLG_OF_RELOBJ) &&
1564                     (IS_LOCALBND(rtype) || IS_SEG_RELATIVE(rtype))) {
1565                         local = TRUE;
1566                 } else if ((sdp->sd_ref == REF_REL_NEED) &&




1526 
1527         /*
1528          * Determine whether this symbol should be bound locally or not.
1529          * Symbols are bound locally if one of the following is true:
1530          *
1531          *  -   the symbol is of type STB_LOCAL.
1532          *
1533          *  -   the output image is not a relocatable object and the relocation
1534          *      is relative to the .got.
1535          *
1536          *  -   the section being relocated is of type SHT_SUNW_dof.  These
1537          *      sections must be bound to the functions in the containing
1538          *      object and can not be interposed upon.
1539          *
1540          *  -   the symbol has been reduced (scoped to a local or symbolic) and
1541          *      reductions are being processed.
1542          *
1543          *  -   the -Bsymbolic flag is in use when building a shared object,
1544          *      and the symbol hasn't explicitly been defined as nodirect.
1545          *
1546          *  -   an executable (fixed address) )is being created, and the symbol
1547          *      is defined in the executable.
1548          *
1549          *  -   the relocation is against a segment which will not be loaded
1550          *      into memory.  In this case, the relocation must be resolved
1551          *      now, as ld.so.1 can not process relocations against unmapped
1552          *      segments.
1553          */
1554         local = FALSE;
1555         if (ELF_ST_BIND(sdp->sd_sym->st_info) == STB_LOCAL) {
1556                 local = TRUE;
1557         } else if (!(reld->rel_flags & FLG_REL_LOAD)) {
1558                 local = TRUE;
1559         } else if (sdp->sd_sym->st_shndx != SHN_UNDEF) {
1560                 if (reld->rel_isdesc &&
1561                     reld->rel_isdesc->is_shdr->sh_type == SHT_SUNW_dof) {
1562                         local = TRUE;
1563                 } else if (!(flags & FLG_OF_RELOBJ) &&
1564                     (IS_LOCALBND(rtype) || IS_SEG_RELATIVE(rtype))) {
1565                         local = TRUE;
1566                 } else if ((sdp->sd_ref == REF_REL_NEED) &&