This is the mail archive of the binutils@sourceware.org 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: GAS: changing name of default sections .text/.data/.rodata


Hi Etienne,

 As I said at end of my E-mail, the Linux Makefile is a bit
complex and just has a list of file to compile:

Sorry, I am still not quite getting this.


 For instance, part of the Linux patch (WEB link I gave) in
arch/i386/kernel/Makefile:
 obj-y	:= process.o semaphore.o signal.o entry.o traps.o irq.o \
     ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \
     pci-dma.o i386_ksyms.o i387.o dmi_scan.o bootflag.o \
-    quirks.o i8237.o i8253.o tsc.o
+    quirks.o i8237.o i8253.o tsc.o realmode.o

 Sometimes, you also want to compile all the files with the
same compiler options, even if they just share typedef's
and structures (aligment and packed problems).

Right that is fine.


 Moreover, in this case, the file realmode.o is pre-linked
in "arch/i386/kernel/built-in.o" so the Makefile rule to obtain
realmode.o from realmode.c has to be special involving an added
objcopy, and so another file extension for the intermediate file.

Are you saying that the Makefile already has an intermediate step that runs objcopy as part of the process to create realmode.o ? If so, what is hard about adding a second objcopy step (or an augmented first objcopy step) to rename the sections in the manner you desire ?


 And the process to obtain built-in.o is common to all
subdirectory so I cannot add a test for just a file.

But you can add a special rule to the Makefile to handle it.


So for example you could change the objects list in the Makefile to rename built-in.o to mangled-built-in.o and then make a make rule like this:

  mangled-built-in.o: builtin.o
   objcopy --rename-section .text=.text16 built-in.o mangled-built-in.o

Wouldn't this work ?

Cheers
  Nick



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