aboutsummaryrefslogtreecommitdiff
path: root/bfd/aoutx.h
diff options
context:
space:
mode:
authorJohn Gilmore <gnu@cygnus>1991-09-04 07:52:46 +0000
committerJohn Gilmore <gnu@cygnus>1991-09-04 07:52:46 +0000
commit12e7087f536972db65252d9db6c04cf8441724ff (patch)
tree6ba2be18873bade4e6644421ceb7b03836f270fb /bfd/aoutx.h
parentbdbd5f508635fa9581f85bd6ba7ec3620970674d (diff)
downloadgdb-12e7087f536972db65252d9db6c04cf8441724ff.zip
gdb-12e7087f536972db65252d9db6c04cf8441724ff.tar.gz
gdb-12e7087f536972db65252d9db6c04cf8441724ff.tar.bz2
Allow GDB to patch object files.
Makefile.in: Add crude dependencies.
Diffstat (limited to 'bfd/aoutx.h')
-rw-r--r--bfd/aoutx.h47
1 files changed, 29 insertions, 18 deletions
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index b6d7e41..08c5c99 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -703,26 +703,37 @@ DEFUN(NAME(aout,set_section_contents),(abfd, section, location, offset, count),
bfd_size_type count)
{
if (abfd->output_has_begun == false)
- { /* set by bfd.c handler */
- if ((obj_textsec (abfd) == NULL) || (obj_datasec (abfd) == NULL))
- {
- bfd_error = invalid_operation;
- return false;
+ { /* set by bfd.c handler */
+ switch (abfd->direction)
+ {
+ case read_direction:
+ case no_direction:
+ bfd_error = invalid_operation;
+ return false;
+
+ case both_direction:
+ break;
+
+ case write_direction:
+ if ((obj_textsec (abfd) == NULL) || (obj_datasec (abfd) == NULL))
+ {
+ bfd_error = invalid_operation;
+ return false;
+ }
+ /*if (abfd->flags & D_PAGED) {
+ obj_textsec(abfd)->filepos = 0;
}
-/* if (abfd->flags & D_PAGED) {
- obj_textsec(abfd)->filepos = 0;
- }
- else*/ {
- obj_textsec(abfd)->filepos = EXEC_BYTES_SIZE;
+ else*/ {
+ obj_textsec(abfd)->filepos = EXEC_BYTES_SIZE;
+ }
+ obj_textsec(abfd)->size = align_power(obj_textsec(abfd)->size,
+ obj_textsec(abfd)->alignment_power);
+ obj_datasec(abfd)->filepos = obj_textsec (abfd)->size + EXEC_BYTES_SIZE;
+ obj_datasec(abfd)->size = align_power(obj_datasec(abfd)->size,
+ obj_datasec(abfd)->alignment_power);
}
- obj_textsec(abfd)->size = align_power(obj_textsec(abfd)->size,
- obj_textsec(abfd)->alignment_power);
- obj_datasec(abfd)->filepos = obj_textsec (abfd)->size + EXEC_BYTES_SIZE;
- obj_datasec(abfd)->size = align_power(obj_datasec(abfd)->size,
- obj_datasec(abfd)->alignment_power);
-
-
- }
+ }
+
/* regardless, once we know what we're doing, we might as well get going */
if (section != obj_bsssec(abfd))
{