This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: looking for non-loaded, non-writable, non-allocated elf segment


>> #ifdef __ELF__
>> 	__attribute__((section(".netbsd.config")))
>> #endif /* __ELF__ */
>...
>I would say that you are looking for a new gcc feature: if a variable
>marked unused is placed in a special section, gcc should not request
>that the section be allocatable.  This is not a binutils issue.

that's fair.  i'll move over there for some of this issue, then.
certainly sections of binaries that contain only unused stuff should
not be loaded, but i imagine that's fairly non-trivial.

>Your workaround depends upon the particular implementation used by
>both gcc and gas.  It may continue to work in future releases, but you
>should not expect it.  It may work for other targets, but you should
>not expect that either.

okay.  i sort of expected the "might not continue" answer, and i do
only expect it to work on elf (as indicated above), but...there is a
certain interaction between the compiler and the assembler that i
still feel uncertain on.

the comment in the gas source to which i referred says this:

/* Handle the .section pseudo-op.  This code supports two different
   syntaxes.

   The first is found on Solaris, and looks like
       .section ".sec1",#alloc,#execinstr,#write
   Here the names after '#' are the SHF_* flags to turn on for the
   section.  I'm not sure how it determines the SHT_* type (BFD
   doesn't really give us control over the type, anyhow).

   The second format is found on UnixWare, and probably most SVR4
   machines, and looks like
       .section .sec1,"a",@progbits
   The quoted string may contain any combination of a, w, x, and
   represents the SHF_* flags to turn on for the section.  The string
   beginning with '@' can be progbits or nobits.  There should be
   other possibilities, but I don't know what they are.  In any case,
   BFD doesn't really let us set the section type.  */

but gas doesn't seem to like the first form under netbsd.  is this
because the first form is *only* available under solaris?  certainly
gcc under netbsd is emitting sequences that resemble the second form,
even though it's not "unixware or svr4".  i wonder if bfd could easily
be extended to allow "setting the section type"...

-- 
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org             * "ah!  i see you have the internet
twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
andrew@crossbar.com       * "information is power -- share the wealth."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]