summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2002-10-23 13:24:10 +0000
committerNick Clifton <nickc@redhat.com>2002-10-23 13:24:10 +0000
commit46cc0c0853a70578ae235ce16e8b63b04ddfefa2 (patch)
tree5acc235fa9ab1fa38066a0df8c2bde2b1d708607
parenta25ce292c38b3a488ebb369933a976979f94081a (diff)
downloadbinutils-redhat-46cc0c0853a70578ae235ce16e8b63b04ddfefa2.tar.gz
Add new command line option "--no-omagic" which undoes the effects of -N.
-rw-r--r--ld/ChangeLog8
-rw-r--r--ld/NEWS2
-rw-r--r--ld/ld.texinfo13
-rw-r--r--ld/lexsup.c9
4 files changed, 30 insertions, 2 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 2a4080b6f2..9bbbbf3296 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,11 @@
+2002-10-23 Nick Clifton <nickc@redhat.com>
+
+ * lexsup.c (OPTION_NO_OMAGIC): Define.
+ (ld_options): Add "no-omagic" option.
+ (parse_args): Parse --no-omagic.
+ * ld.texinfo: Document --no-omagic.
+ * NEWS: Mention new option.
+
2002-10-21 Danny Smith <dannysmith@users.sourceforeg.net>
* scripttempl/pe.sc (__RUNTIME_PSEUDO_RELOC_LIST__,
diff --git a/ld/NEWS b/ld/NEWS
index e4edb83f9f..790b263b1e 100644
--- a/ld/NEWS
+++ b/ld/NEWS
@@ -1,5 +1,7 @@
-*- text -*-
+* Added --no-omagic to undo the effects of the -N option.
+
* Support for Texas Instruments TMS320C4x and TMS320C3x series of
DSP's contributed by Michael Hayes and Svein E. Seldal.
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index 789e8940bb..edf628d36d 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -660,8 +660,17 @@ Turn off page alignment of sections, and mark the output as
@item -N
@itemx --omagic
Set the text and data sections to be readable and writable. Also, do
-not page-align the data segment. If the output format supports Unix
-style magic numbers, mark the output as @code{OMAGIC}.
+not page-align the data segment, and disable linking against shared
+libraries. If the output format supports Unix style magic numbers,
+mark the output as @code{OMAGIC}.
+
+@kindex --no-omagic
+@cindex OMAGIC
+@item --no-omagic
+This option negates most of the effects of the @option{-N} option. It
+sets the text section to be read-only, and forces the data segment to
+be page-aligned. Note - this option does not enable linking against
+shared libraries. Use @option{-Bdynamic} for this.
@kindex -o @var{output}
@kindex --output=@var{output}
diff --git a/ld/lexsup.c b/ld/lexsup.c
index bfb0feaaf7..15c7bac2e9 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -132,6 +132,7 @@ int parsing_defsym = 0;
#define OPTION_SPARE_DYNAMIC_TAGS (OPTION_DISCARD_NONE + 1)
#define OPTION_NO_DEFINE_COMMON (OPTION_SPARE_DYNAMIC_TAGS + 1)
#define OPTION_NOSTDLIB (OPTION_NO_DEFINE_COMMON + 1)
+#define OPTION_NO_OMAGIC (OPTION_NOSTDLIB + 1)
/* The long options. This structure is used for both the option
parsing and the help text. */
@@ -217,6 +218,8 @@ static const struct ld_option ld_options[] =
{ {"omagic", no_argument, NULL, 'N'},
'N', NULL, N_("Do not page align data, do not make text readonly"),
EXACTLY_TWO_DASHES },
+ { {"no-omagic", no_argument, NULL, OPTION_NO_OMAGIC},
+ '\0', NULL, N_("Page align data, make text readonly"), EXACTLY_TWO_DASHES },
{ {"output", required_argument, NULL, 'o'},
'o', N_("FILE"), N_("Set output file name"), EXACTLY_TWO_DASHES },
{ {NULL, required_argument, NULL, '\0'},
@@ -745,6 +748,12 @@ parse_args (argc, argv)
config.magic_demand_paged = false;
config.dynamic_link = false;
break;
+ case OPTION_NO_OMAGIC:
+ config.text_read_only = true;
+ config.magic_demand_paged = true;
+ /* NB/ Does not set dynamic_link to true.
+ Use --call-shared or -Bdynamic for this. */
+ break;
case 'n':
config.magic_demand_paged = false;
config.dynamic_link = false;