From: Ian Lance Taylor <ian@cygnus.com>
To: tranle@intellicorp.com
Cc: gas2@cygnus.com
Subject: Re: problem with ld (i386-coff) leaving holes in the
Date: Wed, 10 Aug 1994 10:03:00 -0000 [thread overview]
Message-ID: <199408101703.NAA05133@sanguine.cygnus.com> (raw)
In-Reply-To: <199408092045.AA17786@bridge2.NSD.3Com.COM>
Date: Tue, 9 Aug 94 13:43:16 PDT
From: Minh Tran-Le <TRANLE@intellicorp.com>
Maybe the function styp_to_sec_flags should not set the default
section flags to SEC_LOAD|SEC_ALLOC.
I'm scared to make that change. I'm sure it would break on some
system in a way that would be difficult to fix. How about the
following (untested) patch instead? After installing this, do ``make
headers'' in the bfd object directory to rebuild libcoff.h.
Ian
*** coffcode.h.~16~ Mon Aug 8 10:48:52 1994
--- coffcode.h Wed Aug 10 12:07:20 1994
*************** sec_to_styp_flags (sec_name, sec_flags)
*** 405,413 ****
* in sec_to_styp_flags().
*/
static flagword
! styp_to_sec_flags (abfd, hdr)
! bfd * abfd;
PTR hdr;
{
struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr;
long styp_flags = internal_s->s_flags;
--- 405,414 ----
* in sec_to_styp_flags().
*/
static flagword
! styp_to_sec_flags (abfd, hdr, name)
! bfd *abfd;
PTR hdr;
+ const char *name;
{
struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr;
long styp_flags = internal_s->s_flags;
*************** styp_to_sec_flags (abfd, hdr)
*** 457,462 ****
--- 458,511 ----
sec_flags |= SEC_DEBUGGING;
#endif
}
+ else if (strcmp (name, _TEXT) == 0)
+ {
+ if (sec_flags & SEC_NEVER_LOAD)
+ sec_flags |= SEC_CODE | SEC_COFF_SHARED_LIBRARY;
+ else
+ sec_flags |= SEC_CODE | SEC_LOAD | SEC_ALLOC;
+ }
+ else if (strcmp (name, _DATA) == 0
+ #ifdef TWO_DATA_SECS
+ || strcmp (name, ".data2") == 0
+ #endif
+ )
+ {
+ if (sec_flags & SEC_NEVER_LOAD)
+ sec_flags |= SEC_DATA | SEC_COFF_SHARED_LIBRARY;
+ else
+ sec_flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC;
+ }
+ else if (strcmp (name, _BSS) == 0)
+ {
+ #ifdef BSS_NOLOAD_IS_SHARED_LIBRARY
+ if (sec_flags & SEC_NEVER_LOAD)
+ sec_flags |= SEC_ALLOC | SEC_COFF_SHARED_LIBRARY;
+ else
+ #endif
+ sec_flags |= SEC_ALLOC;
+ }
+ else if (strcmp (name, ".debug") == 0
+ #ifdef _COMMENT
+ || strcmp (name, _COMMENT) == 0
+ #endif
+ || strcmp (name, ".stab") == 0
+ || strcmp (name, ".stabstr") == 0)
+ {
+ #ifdef COFF_PAGE_SIZE
+ sec_flags |= SEC_DEBUGGING;
+ #endif
+ }
+ #ifdef _LIB
+ else if (strcmp (name, _LIB) == 0)
+ ;
+ #endif
+ #ifdef _LIT
+ else if (strcmp (name, _LIT) == 0)
+ {
+ sec_flags = SEC_LOAD | SEC_ALLOC | SEC_READONLY;
+ }
+ #endif
else
{
sec_flags |= SEC_ALLOC | SEC_LOAD;
*************** dependent COFF routines:
*** 585,591 ****
. PTR internal_aouthdr));
. flagword (*_bfd_styp_to_sec_flags_hook) PARAMS ((
. bfd *abfd,
! . PTR internal_scnhdr));
. asection *(*_bfd_make_section_hook) PARAMS ((
. bfd *abfd,
. char *name));
--- 634,641 ----
. PTR internal_aouthdr));
. flagword (*_bfd_styp_to_sec_flags_hook) PARAMS ((
. bfd *abfd,
! . PTR internal_scnhdr,
! . const char *name));
. asection *(*_bfd_make_section_hook) PARAMS ((
. bfd *abfd,
. char *name));
*************** dependent COFF routines:
*** 671,678 ****
.#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
. ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr))
.
! .#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr)\
! . ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook) (abfd, scnhdr))
.
.#define bfd_coff_make_section_hook(abfd, name)\
. ((coff_backend_info (abfd)->_bfd_make_section_hook) (abfd, name))
--- 721,728 ----
.#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
. ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr))
.
! .#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name)\
! . ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook) (abfd, scnhdr, name))
.
.#define bfd_coff_make_section_hook(abfd, name)\
. ((coff_backend_info (abfd)->_bfd_make_section_hook) (abfd, name))
Index: coffgen.c
===================================================================
RCS file: /rel/cvsfiles/devo/bfd/coffgen.c,v
retrieving revision 1.34
diff -p -r1.34 coffgen.c
*** coffgen.c 1994/06/21 16:46:51 1.34
--- coffgen.c 1994/08/10 17:03:06
*************** make_a_section_from_file (abfd, hdr, tar
*** 99,105 ****
return_section->lineno_count = hdr->s_nlnno;
return_section->userdata = NULL;
return_section->next = (asection *) NULL;
! return_section->flags = bfd_coff_styp_to_sec_flags_hook (abfd, hdr);
return_section->target_index = target_index;
--- 99,105 ----
return_section->lineno_count = hdr->s_nlnno;
return_section->userdata = NULL;
return_section->next = (asection *) NULL;
! return_section->flags = bfd_coff_styp_to_sec_flags_hook (abfd, hdr, name);
return_section->target_index = target_index;
prev parent reply other threads:[~1994-08-10 10:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-08-07 10:59 problem with ld (i386-coff) leaving holes in the executable Minh Tran-Le
1994-08-08 7:59 ` Ian Lance Taylor
1994-08-08 20:11 ` problem with ld (i386-coff) leaving holes in the Minh Tran-Le
1994-08-09 6:58 ` Ian Lance Taylor
1994-08-09 14:11 ` Minh Tran-Le
1994-08-10 10:03 ` Ian Lance Taylor [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199408101703.NAA05133@sanguine.cygnus.com \
--to=ian@cygnus.com \
--cc=gas2@cygnus.com \
--cc=tranle@intellicorp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).