ld
has additional features on some platforms; the following
sections describe them. Machines where ld
has no additional
functionality are not listed.
ld
´Â ´ÙÀ½¿¡ ¼³¸íÇÏ´Â ¸î¸î Ç÷¡Æû¿¡ Ãß°¡ ±â´ÉÀÌ ÀÖ´Ù.
Ãß°¡ ±â´ÉÀÌ ¾ø´Â Ç÷¡ÆûÀº ¿°ÅÇÏÁö ¾Ê´Â´Ù.
ld
°ú the H8/300
For the H8/300,
H8/300¿¡¼ `--relax' ¿É¼ÇÀº Àü¿ª ÃÖÀûȸ¦ ÇÑ´Ù.
ld
can perform these global optimizations when
you specify the `--relax' command-line option.
ld
finds all jsr
and jmp
instructions whose
targets are within eight bits, and turns them into eight-bit
program-counter relative bsr
and bra
instructions,
respectively.
jsr
°ú jmp
¸í·ÉÀ» °¢°¢ 8 ºñÆ®ÀÇ ÇÁ·Î±×·¥ Ä«¿îÅÍ »ó´ëÀûÀÎ bsr
°ú bra
¸í·ÉÀ¸·Î º¯È¯ÇÑ´Ù.
ld
finds all mov.b
instructions which use the
sixteen-bit absolute address form, but refer to the top
page of memory, and changes them to use the eight-bit address form.
(That is: the linker turns `mov.b @
aa:16' into
`mov.b @
aa:8' whenever the address aa is in the
top page of memory).
mov.b
¸í·ÉÀ» 8 ºñÆ® ÁÖ¼Ò Çü½ÄÀ¸·Î º¯È¯ÇÑ´Ù.
(Áï, ÁÖ¼Ò aa°¡ ¸Þ¸ð¸®ÀÇ ÃÖ°í ÆäÀÌÁö¿¡ ÀÖÀ¸¸é
`mov.b @
aa:16'À»
`mov.b @
aa:8'À¸·Î º¯È¯ÇÑ´Ù)
ld
°ú Intel 960 °è¿You can use the `-Aarchitecture' command line option to specify one of the two-letter names identifying members of the 960 family; the option specifies the desired output target, and warns of any incompatible instructions in the input files. It also modifies the linker's search strategy for archive libraries, to support the use of libraries specific to each particular architecture, by including in the search loop names suffixed with the string identifying the architecture.
For example, if your ld
command line included `-ACA' as
well as `-ltry', the linker would look (in its built-in search
paths, and in any paths you specify with `-L') for a library with
the names
960 °è¿ÀÇ ¸â¹ö¸¦ ³ªÅ¸³»´Â µÎ ¹®ÀÚ¸¦ `-Aarchitecture'
¿É¼Ç¿¡ »ç¿ëÇÒ ¼ö ÀÖ´Ù. ÀÌ ¿É¼ÇÀº ¿øÇÏ´Â Ãâ·ÂÀ» ÁöÁ¤ÇÏ°í ÀÔ·ÂÆÄÀÏ¿¡
ȣȯµÇÁö ¾ÊÀº ¸í·ÉÀÌ ÀÖ´Ù¸é °æ°íÇÑ´Ù. ¶Ç °¢ ¾ÆÅ°ÅØÃÄ Æ¯À¯ÀÇ ¶óÀ̺귯¸®¸¦
Áö¿øÇϱâ À§Çؼ ¾ÆÅ°ÅØÃĸ¦ ³ª³ªÅ´ ¹®ÀÚ¸¦ Á¢¹Ì»ç·Î »ç¿ëÇÏ¿©
¾ÆÄ«ÀÌºê ¶óÀ̺귯¸® °Ë»ö ¹æ¹ýÀ» º¯°æÇÑ´Ù.
try
libtry.a
tryca
libtryca.a
The first two possibilities would be considered in any event; the last two are due to the use of `-ACA'.
You can meaningfully use `-A' more than once on a command line, since the 960 architecture family allows combination of target architectures; each use will add another pair of name variants to search for when `-l' specifies a library.
óÀ½ µÎ°³´Â ¾î¶² °æ¿ì¿¡µµ »ç¿ëµÇÁö¸¸, ¸¶Áö¸· µÎ°³´Â `-ACA'
¶§¹®¿¡ »ç¿ëµÈ´Ù.
960 °è¿Àº ´ë»ó ¾ÆÅ°ÅØÃĸ¦ È¥ÇÕÀÌ °¡´ÉÇϹǷΠ`-A'À»
¿©·¯¹ø »ç¿ëÇصµ µÈ´Ù. °¢ ¿É¼ÇÀº `-l'ÀÌ ¶óÀ̺귯¸®¸¦ Áö½ÃÇÒ ¶§
º¯ÇüµÈ À̸§µéÀ» °Ë»öÇÏ°Ô ÇÑ´Ù.
i960 °è¿Àº `--relax' ¿É¼ÇÀ» Áö¿øÇÑ´Ù. `--relax'¸¦
»ç¿ëÇÏ¸é ´ë»óÀÌ 24 ºñÆ® ³»¿¡ ÀÖ´Â ¸ðµç ld
supports the `--relax' option for the i960 family. If
you specify `--relax', ld
finds all balx
and
calx
instructions whose targets are within 24 bits, and turns
them into 24-bit program-counter relative bal
and cal
instructions, respectively. ld
also turns cal
instructions into bal
instructions when it determines that the
target subroutine is a leaf routine (that is, the target subroutine does
not itself call any subroutines).
balx
¿Í
calx
¸í·ÉÀ» °¢°¢ 24 ºñÆ® ÇÁ·Î±×·¥ Ä«¿îÅÍ »ó´ëÀûÀÎ bal
°ú
cal
¸í·ÉÀ¸·Î º¯È¯ÇÑ´Ù. ¶ÇÇÑ ´ë»óÀÌ (´Ù¸¥ ÇÔ¼ö¸¦ È£ÃâÇÏÁö ¾ÊÀ¸¸é ÇÔ¼öÀÎ)
¸®ÇÁ ÇÔ¼ö(leaf routine)¶ó¸é cal
¸í·ÉÀ» bal
¸í·ÉÀ¸·Î º¯È¯ÇÑ´Ù.
ARM°ú Thumb ÄÚµåÀÇ °áÇÕ Áö¿ø
For the ARM, ld
will generate code stubs to allow functions calls
betweem ARM and Thumb code. These stubs only work with code that has
been compiled and assembled with the `-mthumb-interwork' command
line option. If it is necessary to link with old ARM object files or
libraries, which have not been compiled with the -mthumb-interwork
option then the `--support-old-code' command line switch should be
given to the linker. This will make it generate larger stub functions
which will work with non-interworking aware ARM code. Note, however,
the linker does not support generating stubs for function calls to
non-interworking aware Thumb code.
The `--thumb-entry' switch is a duplicate of the generic
`--entry' switch, in that it sets the program's starting address.
But it also sets the bottom bit of the address, so that it can be
branched to using a BX instruction, and the program will start
executing in Thumb mode straight away.
ARM¿¡¼
`--thumb-entry' ¿É¼ÇÀº ÇÁ·Î±×·¥ÀÇ ½ÃÀÛ ÁÖ¼Ò¸¦ ¼³Á¤ÇÏ´Â
ÀÏ¹Ý ¿É¼Ç `--entry'¿Í °°´Ù. ±×·¯³ª ÀÌ°ÍÀº ÁÖ¼ÒÀÇ ÇÏÀ§ ºñÆ®µµ
¼³Á¤ÇÏ¿© BX ¸í·ÉÀ» »ç¿ëÇÏ¿© ºÐ±âÇÒ ¼ö ÀÖ°í, ÇÁ·Î±×·¥ÀÌ Ã³À½ºÎÅÍ Thumb ¸ðµå·Î
½ÇÇàÇÒ ¼ö ÀÖ´Ù.
ld
´Â ARM°ú Thumb ÄÚµå °£¿¡ ÇÔ¼ö¸¦ È£ÃâÇÏ´Â
½ºÅÓ ÄÚµå(stub)¸¦ »ý¼ºÇÑ´Ù. ÀÌ ÄÚµå´Â `-mthumb-interwork' ¿É¼ÇÀ»
»ç¿ëÇÏ¿© ÄÄÆÄÀÏÇÏ°í ¾î¼ÀºíÇÑ ÄÚµå¿Í¸¸ µ¿ÀÛÇÑ´Ù.
-mthumb-interwork ¿É¼ÇÀ» »ç¿ëÇÏÁö ¾ÊÀº ¿À·¡µÈ ARM ¿ÀºêÁ§Æ®
ÆÄÀÏÀ̳ª ¶óÀ̺귯¸®¿Í ¸µÅ©ÇÏ·Á¸é ¸µÄ¿¿¡ `--support-old-code' ¿É¼ÇÀ»
»ç¿ëÇØ¾ß ÇÑ´Ù. ±×·¯¸é °ú°Å ARM ÄÚµå¿Í µ¿ÀÛÇÏ´Â ´õ Å« ½ºÅÓ ÇÔ¼ö¸¦ »ý¼ºÇÑ´Ù.
ÁÖÀÇ! ±×·¯³ª ¸µÄ¿´Â °ú°Å Thumb ÄÚµå·Î ÇÔ¼ö È£Ã⸦ ÇÏ´Â ½ºÅÓÀ» »ý¼ºÇÒ ¼ö ¾ø´Ù.
ld
¿Í HPPA 32 ºñÆ® ELF
When generating a shared library,
°øÀ¯ ¶óÀ̺귯¸®¸¦ »ý¼ºÇÒ ¶§ ±âº»ÀûÀ¸·Î ÇÑ sub-space ÇÁ·Î±×·¥¿¡¼ »ç¿ëÇϱâ ÀûÇÕÇÑ
ÀÓÆ÷Æ® ½ºÅÓÀ» »ý¼ºÇÑ´Ù.
`--multi-subspace' ¿É¼ÇÀº ÀͽºÆ÷Æ® ½ºÅÓ°ú ¿©·¯ sub-space¿Í ÀûÇÕÇÑ
(º¸´Ù Å«) ÀÓÆ÷Æ® ½ºÅÓÀ» »ý¼ºÇÑ´Ù.
ld
will by default generate
import stubs suitable for use with a single sub-space application.
The `--multi-subspace' switch causes ld
to generate export
stubs, and different (larger) import stubs suitable for use with
multiple sub-spaces.
Long branch stubs and import/export stubs are placed by
±ä ºÐ±â ½ºÅÓ°ú ÀÓÆ÷Æ®/ÀͽºÆ÷Æ® ½ºÅÓÀº ÀÔ·Â ¼½¼Ç ±º »çÀÌÀÇ ½ºÅÓ ¼½¼Ç¿¡
À§Ä¡ÇÑ´Ù. `--stub-group-size' ¿É¼ÇÀº ÇÑ ½ºÅÓ ¼½¼ÇÀÌ ´Ù·ç´Â
ÀÔ·Â ¼½¼Ç ±ºÀÇ ÃÖ´ë Å©±â¸¦ Á¤ÇÑ´Ù. ºÐ±â ¿É¼ÂÀº ºÎÈ£°¡ Àֱ⠶§¹®¿¡
½ºÅÜ ¼½¼ÇÀº ½ºÅÜ ¼½¼Ç Àü°ú µÚ, µÎ ±ºÀÇ ÀÔ·Â ¼½¼ÇÀ» ´Ù·é´Ù. ±×·¯³ª
½ºÅÓÀÌ ÇÊ¿äÇÑ Á¶°Ç ºÐ±â¸¦ »ç¿ëÇÒ ¶§ ¿ÀÁ÷ ÇÑ ÀÔ·Â ¼½¼Ç ±º¸¸ ´Ù·ç´Â °ÍÀÌ
(ºÐ±â¿¹ÃøÀ» À§ÇØ) ÁÁ´Ù. À½¼ö°ª `N'Àº ½ºÅÜÀ¸·Î ºÐ±â°¡
Ç×»ó À½¼ö ¿É¼ÂÀ» »ç¿ëÇÑ´Ù°í È®½ÅÇÏ¿© ÀÌ ¹æ¹ýÀ» »ç¿ëÇÑ´Ù. `N'À¸·Î
»ç¿ëÇÒ ¼ö Àִ Ưº°ÇÑ µÎ °ªÀº `1'°ú `-1'ÀÌ´Ù.
µÑÀº ¹ß°ßµÈ ºÐ±âÇü¿¡ ´ëÇØ ÀÔ·Â ¼½¼Ç ±ºÀÇ Å©±â¸¦ ÀÚµ¿À¸·Î ¾Ë¾Æ³»°í
½ºÅÓ À§Ä¡¸¦ °¢°¢ `N'ÀÇ ¾ç/À½°ªÀ¸·Î Ãë±ÞÇÑ´Ù.
ld
in
stub sections located between groups of input sections.
`--stub-group-size' specifies the maximum size of a group of input
sections handled by one stub section. Since branch offsets are signed,
a stub section may serve two groups of input sections, one group before
the stub section, and one group after it. However, when using
conditional branches that require stubs, it may be better (for branch
prediction) that stub sections only serve one group of input sections.
A negative value for `N' chooses this scheme, ensuring that
branches to stubs always use a negative offset. Two special values of
`N' are recognized, `1' and `-1'. These both instruct
ld
to automatically size input section groups for the branch types
detected, with the same behaviour regarding stub placement as other
positive or negative values of `N' respectively.
Note that `--stub-group-size' does not split input sections. A
single input section larger than the group size specified will of course
create a larger group (of one section). If input sections are too
large, it may not be possible for a branch to reach its stub.
`--stub-group-size'´Â ÀÔ·Â ¼½¼ÇÀ» ³ª´©Áö ¾Ê´Â´Ù.
ÁöÁ¤ÇÑ Å©±âº¸´Ù ÇÑ ÀÔ·Â ¼½¼ÇÀÌ Å©´Ù¸é ÀÌ ÀÔ·Â ¼½¼ÇÀ» Æ÷ÇÔÇÏ´Â Å« ±ºÀ»
¸¸µç´Ù. ±×·¯³ª ÀÔ·Â ¼½¼ÇÀÌ
³Ê¹« Å©´Ù¸é ºÐ±â°¡ ½ºÅÓ¿¡ µµ´ÞÇÏÁö ¸øÇÒ ¼ö ÀÖ´Ù.
ld
°ú ¿©·¯ TI COFF ¹öÀü
The `--format' switch allows selection of one of the various
TI COFF versions. The latest of this writing is 2; versions 0 and 1 are
also supported. The TI COFF versions also vary in header byte-order
format;
`--format' ¿É¼ÇÀ¸·Î ¿©·¯ TI COFF ¹öÀü Áß Çϳª¸¦ ¼±ÅÃÇÒ ¼ö ÀÖ´Ù.
ÀÌ ±ÛÀ» ¾²´Â ½ÃÁ¡¿¡¼ ÃÖ±Ù ¹öÀüÀº 2ÀÌ´Ù. ¹öÀü 0°ú 1µµ Áö¿øµÈ´Ù.
TI COFF ¹öÀüÀº Çì´õÀÇ ¹ÙÀÌÆ® ¼ø¼¿¡¼ Â÷ÀÌ°¡ ³´Ù. ld
will read any version or byte order, but the output
header format depends on the default specified by the specific target.
ld
´Â
¾î¶² ¹öÀü°ú ¹ÙÀÌÆ® ¼ø¼µµ ÀÐÀ» ¼ö ÀÖ´Ù. ±×·¯³ª Ãâ·Â Çì´õ Çü½ÄÀº ÁöÁ¤µÈ ´ë»óÀÇ
±âº» ¹öÀü¿¡ ÀÇÁ¸ÇÑ´Ù.
Go to the first, previous, next, last section, table of contents.