ldedit Command

Purpose

Modifies an XCOFF executable file header.

Syntax

ldedit -b Option [ -V ] File

Description

You can use the ldedit command to modify various fields in an XCOFF header or the auxiliary header of an executable file. The ldedit command makes it possible to mark or unmark an application as a 'large page data' program. The ldedit command also makes it possible to add or modify the values of MAXDATA and MAXSTACK without relinking.

The format of the -b flag is similar to the format used by the link editor, the ld command. The -b flag can be used multiple times on the command line.

If no flags are specified, the ldedit command displays a usage message using the standard error output.

Flags

Item Description
-bOption Modifies an executable as specified by Option. The possible values for Option are:
aslr or aslr:[[+-][tdsmp]*]*
aslr or aslr:[[+-][tdsmp]*]* specifies the address space layout randomization for the program. The aslr option enables all of the randomization attributes when only this option is used.
If the aslr option is followed by a colon, individual attributes can be enabled. The plus sign (+) enables randomization and the minus sign (-) disables randomization. The following attributes can be used to specify text, data, stack, mmap, and private-libraries: t, d, s, m, and p. For the attributes that are not listed, the randomization setting remains disabled.
Note: The m and p attributes cannot be specified for 32-bit programs.
Some programs are compiled and linked such that relocatable addresses are mapped into the text section. This requires the relocation of the addresses when the program is run. These programs fail if randomization is enabled for text or data. As a result, when text-section relocations exist, text and data randomization are not enabled unless the t and d attributes are explicitly specified when using the aslr option.
noaslr
Clears the randomization attribute settings of the program.
datapsize:psize
Requests psize page sizes in bytes for data. The value can be specified as a decimal, hexadecimal, or octal number. The number specifications are the same as in C programming language. Additionally, the page sizes can be specified as a number followed by a one-character suffix:
  • k or K for kilo or 0x400 bytes
  • m or M for mega or 0x100000 bytes
  • g or G for giga or 0x40000000 bytes
  • t or T for tera or 0x10000000000 bytes
  • p or P for peta or 0x4000000000000 bytes
  • x or X for exo or 0x1000000000000000 bytes
For example, either -b datapsize:16k or -b datapsize:0x4000 will request 0x4000 for data and set the F_VARPG bit in the XCOFF header. It is accomplished by setting the corresponding member of the auxiliary header to the logarithm base 2 of the given value psize. If the value is different from 0, the F_VARPG bit of the XCOFF header's f_flags member is also set. Otherwise, this bit is cleared.
forkpolicy:policy
Sets the _AOUT_FORK_POLICY flag in the XCOFF auxiliary header, if File is a 64-bit program. If policy is cor, the _AOUT_FORK_COW is also set, requesting the use of the copy-on-write forktree policy. If policy is cow, the _AOUT_FORK_COW flag is cleared, requesting the use of the copy-on-reference forktree policy. If File is a 32-bit program, no change is made.
noforkpolicy
Resets the _AOUT_FORK_POLICY and _AOUT_FORK_COR flags in the XCOFF auxiliary header, if File is a 64-bit program. The default forktree policy is used, unless a forktree policy is specified with the VMM_CNTRL environment variable. If File is a 32-bit program, no change is made.
lpdata
Marks a file as a 'large page data' executable.
nolpdata
Unmarks a file as a 'large page data' executable.
noshrsymtab
Clears the _AOUT_SHR_SYMTAB flag in the XCOFF auxiliary header. If File is a 32-bit object, no change is made.
M:<modtype>
Updates the module-type field and the shared object flag in the file. The F_SHROBJ flag is set in the XCOFF header when the module type begins with S character and is 3 characters long.
maxdata:value
Sets the MAXDATA value. value is an octal number when it starts with 0, a hexadecimal number when it starts with 0x, and a decimal number in all other cases.
maxdata:value/dsa
Sets the MAXDATA value and the DSA bit. value is an octal number when it starts with 0, a hexadecimal number when it starts with 0x, and a decimal number in all other cases.
 
maxstack:value
Sets the MAXSTACK value. value is an octal number when it starts with 0, a hexadecimal number when it starts with 0x, and a decimal number in all other cases.
norwexec
Marks a file's writable and mappable sections and stack as non-executable.
rwexec
Marks a file's writable and mappable sections and stack as executable.
shrsymtab
Sets the _AOUT_SHR_SYMTAB flag in the XCOFF auxiliary header. If File is a 64-bit program, a shared symbol table is created when the program is run. If Flag is a 64-bit object but not a 64-bit program, the _AOUT_SHR_SYMTAB flag can be set, but has no effect at runtime. If File is a 32-bit object, no change is made.
 
stackpsize:psize
Requests psize page sizes in bytes for process main thread stack. The value can be specified as a decimal, hexadecimal, or octal number. The number specifications are the same as in C programming language. Additionally, the page sizes can be specified as a number followed by a one-character suffix:
  • k or K for kilo or 0x400 bytes
  • m or M for mega or 0x100000 bytes
  • g or G for giga or 0x40000000 bytes
  • t or T for tera or 0x10000000000 bytes
  • p or P for peta or 0x4000000000000 bytes
  • x or X for exo or 0x1000000000000000 bytes
For example, either -b stackpsize:16k or -b stackpsize:0x4000 will request 0x4000 for process main thread stack and set the F_VARPG bit in the XCOFF header. It is accomplished by setting the corresponding member of the auxiliary header to the logarithm base 2 of the given value psize. If the value is different from 0, the F_VARPG bit of the XCOFF header's f_flags member is also set. Otherwise, this bit is cleared.
textpsize:psize
Requests psize page sizes in bytes for text. The value can be specified as a decimal, hexadecimal, or octal number. The number specifications are the same as in C programming language. Additionally, the page sizes can be specified as a number followed by a one-character suffix:
  • k or K for kilo or 0x400 bytes
  • m or M for mega or 0x100000 bytes
  • g or G for giga or 0x40000000 bytes
  • t or T for tera or 0x10000000000 bytes
  • p or P for peta or 0x4000000000000 bytes
  • x or X for exo or 0x1000000000000000 bytes
For example, either -b textpsize:16k or -b textpsize:0x4000 will request 0x4000 for text and set the F_VARPG bit in the XCOFF header. It is accomplished by setting the corresponding member of the auxiliary header to the logarithm base 2 of the given value psize. If the value is different from 0, the F_VARPG bit of the XCOFF header's f_flags member is also set. Otherwise, this bit is cleared.
-V Prints the version of the ldedit command on the standard error output.

Examples

  1. To request system-selected page sizes for text, data, and stacks, enter:
    ldedit -b textpsize:0 -b datapsize:0 -b stackpsize:0
    This clears the F_VARPG bit in the XCOFF header.
  2. To enable all of the randomization attributes, enter:
    -baslr

    If text-section relocations exist, do not enable text and data randomization.

  3. To enable the randomization for text, disable the randomization for stack, and leave the other values unchanged, enter:
    -baslr:+t-s