aboutsummaryrefslogtreecommitdiff
path: root/bfd/mach-o.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2006-06-01 03:45:58 +0000
committerAlan Modra <amodra@gmail.com>2006-06-01 03:45:58 +0000
commit117ed4f8d5a9691c0bc1200d5d797e5211688c84 (patch)
tree4f57e1654f1a735dd6358ae27f0f705cbd49788e /bfd/mach-o.c
parent13d6194fb981e198cdf887374d8ed3a1737cca0e (diff)
downloadgdb-117ed4f8d5a9691c0bc1200d5d797e5211688c84.zip
gdb-117ed4f8d5a9691c0bc1200d5d797e5211688c84.tar.gz
gdb-117ed4f8d5a9691c0bc1200d5d797e5211688c84.tar.bz2
* stabs.c (_bfd_link_section_stabs): Use bfd_make_section*_with_flags
instead of bfd_make_section*. * aix386-core.c: Likewise. * aix5ppc-core.c: Likewise. * aout-adobe.c: Likewise. * aoutf1.h: Likewise. * binary.c: Likewise. * cisco-core.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * elf.c: Likewise. * elf32-bfin.c: Likewise. * elf32-m32c.c: Likewise. * hppabsd-core.c: Likewise. * hpux-core.c: Likewise. * i386linux.c: Likewise. * ieee.c: Likewise. * ihex.c: Likewise. * irix-core.c: Likewise. * lynx-core.c: Likewise. * m68klinux.c: Likewise. * mach-o.c: Likewise. * netbsd-core.c: Likewise. * nlmcode.h: Likewise. * opncls.c: Likewise. * osf-core.c: Likewise. * peXXigen.c: Likewise. * ppcboot.c: Likewise. * ptrace-core.c: Likewise. * rs6000-core.c: Likewise. * sco5-core.c: Likewise. * sparclinux.c: Likewise. * srec.c: Likewise. * sunos.c: Likewise. * trad-core.c: Likewise. * xcofflink.c: Likewise. * xsym.c: Likewise.
Diffstat (limited to 'bfd/mach-o.c')
-rw-r--r--bfd/mach-o.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/bfd/mach-o.c b/bfd/mach-o.c
index 03a7144..666cf65 100644
--- a/bfd/mach-o.c
+++ b/bfd/mach-o.c
@@ -1,5 +1,5 @@
/* Mach-O support for BFD.
- Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -634,6 +634,7 @@ bfd_mach_o_make_bfd_section (bfd *abfd, bfd_mach_o_section *section)
char *sname;
const char *prefix = "LC_SEGMENT";
unsigned int snamelen;
+ flagword flags;
snamelen = strlen (prefix) + 1
+ strlen (section->segname) + 1
@@ -644,7 +645,10 @@ bfd_mach_o_make_bfd_section (bfd *abfd, bfd_mach_o_section *section)
return NULL;
sprintf (sname, "%s.%s.%s", prefix, section->segname, section->sectname);
- bfdsec = bfd_make_section_anyway (abfd, sname);
+ flags = SEC_ALLOC;
+ if (!(section->flags & BFD_MACH_O_S_ZEROFILL))
+ flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_CODE;
+ bfdsec = bfd_make_section_anyway_with_flags (abfd, sname, flags);
if (bfdsec == NULL)
return NULL;
@@ -654,11 +658,6 @@ bfd_mach_o_make_bfd_section (bfd *abfd, bfd_mach_o_section *section)
bfdsec->filepos = section->offset;
bfdsec->alignment_power = section->align;
- if (section->flags & BFD_MACH_O_S_ZEROFILL)
- bfdsec->flags = SEC_ALLOC;
- else
- bfdsec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_CODE;
-
return bfdsec;
}
@@ -966,7 +965,7 @@ bfd_mach_o_scan_read_dylinker (bfd *abfd,
return -1;
strcpy (sname, prefix);
- bfdsec = bfd_make_section_anyway (abfd, sname);
+ bfdsec = bfd_make_section_anyway_with_flags (abfd, sname, SEC_HAS_CONTENTS);
if (bfdsec == NULL)
return -1;
@@ -975,7 +974,6 @@ bfd_mach_o_scan_read_dylinker (bfd *abfd,
bfdsec->size = command->len - 8;
bfdsec->filepos = command->offset + 8;
bfdsec->alignment_power = 0;
- bfdsec->flags = SEC_HAS_CONTENTS;
cmd->section = bfdsec;
@@ -1022,7 +1020,7 @@ bfd_mach_o_scan_read_dylib (bfd *abfd, bfd_mach_o_load_command *command)
return -1;
strcpy (sname, prefix);
- bfdsec = bfd_make_section_anyway (abfd, sname);
+ bfdsec = bfd_make_section_anyway_with_flags (abfd, sname, SEC_HAS_CONTENTS);
if (bfdsec == NULL)
return -1;
@@ -1031,7 +1029,6 @@ bfd_mach_o_scan_read_dylib (bfd *abfd, bfd_mach_o_load_command *command)
bfdsec->size = command->len - 8;
bfdsec->filepos = command->offset + 8;
bfdsec->alignment_power = 0;
- bfdsec->flags = SEC_HAS_CONTENTS;
cmd->section = bfdsec;
@@ -1142,14 +1139,13 @@ bfd_mach_o_scan_read_thread (bfd *abfd, bfd_mach_o_load_command *command)
j++;
}
- bfdsec = bfd_make_section (abfd, sname);
+ bfdsec = bfd_make_section_with_flags (abfd, sname, SEC_HAS_CONTENTS);
bfdsec->vma = 0;
bfdsec->lma = 0;
bfdsec->size = cmd->flavours[i].size;
bfdsec->filepos = cmd->flavours[i].offset;
bfdsec->alignment_power = 0x0;
- bfdsec->flags = SEC_HAS_CONTENTS;
cmd->section = bfdsec;
}
@@ -1218,7 +1214,7 @@ bfd_mach_o_scan_read_symtab (bfd *abfd, bfd_mach_o_load_command *command)
return -1;
strcpy (sname, prefix);
- bfdsec = bfd_make_section_anyway (abfd, sname);
+ bfdsec = bfd_make_section_anyway_with_flags (abfd, sname, SEC_HAS_CONTENTS);
if (bfdsec == NULL)
return -1;
@@ -1227,7 +1223,6 @@ bfd_mach_o_scan_read_symtab (bfd *abfd, bfd_mach_o_load_command *command)
bfdsec->size = seg->nsyms * 12;
bfdsec->filepos = seg->symoff;
bfdsec->alignment_power = 0;
- bfdsec->flags = SEC_HAS_CONTENTS;
seg->stabs_segment = bfdsec;
@@ -1237,7 +1232,7 @@ bfd_mach_o_scan_read_symtab (bfd *abfd, bfd_mach_o_load_command *command)
return -1;
strcpy (sname, prefix);
- bfdsec = bfd_make_section_anyway (abfd, sname);
+ bfdsec = bfd_make_section_anyway_with_flags (abfd, sname, SEC_HAS_CONTENTS);
if (bfdsec == NULL)
return -1;
@@ -1246,7 +1241,6 @@ bfd_mach_o_scan_read_symtab (bfd *abfd, bfd_mach_o_load_command *command)
bfdsec->size = seg->strsize;
bfdsec->filepos = seg->stroff;
bfdsec->alignment_power = 0;
- bfdsec->flags = SEC_HAS_CONTENTS;
seg->stabstr_segment = bfdsec;
@@ -1263,6 +1257,7 @@ bfd_mach_o_scan_read_segment (bfd *abfd, bfd_mach_o_load_command *command)
char *sname;
const char *prefix = "LC_SEGMENT";
unsigned int snamelen;
+ flagword flags;
BFD_ASSERT (command->type == BFD_MACH_O_LC_SEGMENT);
@@ -1286,7 +1281,8 @@ bfd_mach_o_scan_read_segment (bfd *abfd, bfd_mach_o_load_command *command)
return -1;
sprintf (sname, "%s.%s", prefix, seg->segname);
- bfdsec = bfd_make_section_anyway (abfd, sname);
+ flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_CODE;
+ bfdsec = bfd_make_section_anyway_with_flags (abfd, sname, flags);
if (bfdsec == NULL)
return -1;
@@ -1295,7 +1291,6 @@ bfd_mach_o_scan_read_segment (bfd *abfd, bfd_mach_o_load_command *command)
bfdsec->size = seg->filesize;
bfdsec->filepos = seg->fileoff;
bfdsec->alignment_power = 0x0;
- bfdsec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_CODE;
seg->segment = bfdsec;