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]

[RFH] How to make ld use the LDEMUL_PLACE_ORPHAN hook.


Hi,

For using banked memory for the hc12 port I'd like to use the

LDEMUL_PLACE_ORPHAN=gld${EMULATION_NAME}_place_orphan 

target hook for dynamically choosing where to place sections. I am now facing 
the problem that it seems that the target hook function is never excecuted 
indepenent of wether or not the section shows up in the linker script.

I.e. I am having an "gld${EMULATION_NAME}_place_orphan" function whose start 
reads

static bfd_boolean
gld${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection 
*s)
{
  const char *secname;
  const char *orig_secname;
  lang_output_section_statement_type *os;
  lang_statement_list_type add_child;
  unsigned int section_size;

  printf ("Hallo Welt. \n");
  exit (42);

. So once this function is executed I'd expect to get some text on stdout and 
an aborted link process. I am linking object files with names that surely 
never show up in the linker script. E.g. ".bankedtext.outchar". I know that 
my hook function seems to be required for linking ld since if I rename my 
hook function there are unresolved symbols.

However, ld does never enter the target hook function above but silently 
generates an object file without complaints. The generated file contains all 
of the input sections. E.g. printout of "readelf -S out/test.elf | egrep -v 
00000000 | egrep -e'^ +[[]" :


  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf 
Al
  [ 2] .install0         PROGBITS        00000016 001016 000003 00  AX  0   0  
1
  [ 3] .install2         PROGBITS        00000019 001019 000022 00  AX  0   0  
1
  [ 4] .install4         PROGBITS        0000003b 00103b 00000e 00  AX  0   0  
1
  [ 5] .bankedtext.outch PROGBITS        00000049 001049 00000e 00  AX  0   0  
1
  [ 6] .bankedtext.main  PROGBITS        00000057 001057 00000e 00  AX  0   0  
1
  [ 7] .bankedtext.exit  PROGBITS        00000065 001065 000120 00  AX  0   0  
1
  [ 8] .bankedtext.close PROGBITS        00000185 001185 000011 00  AX  0   0  
1
  [ 9] .bankedtext.fstat PROGBITS        00000196 001196 00001d 00  AX  0   0  
1
  [10] .bankedtext.getpi PROGBITS        000001b3 0011b3 000011 00  AX  0   0  
1
  [11] .bankedtext.isatt PROGBITS        000001c4 0011c4 000011 00  AX  0   0  
1
  [12] .bankedtext.lseek PROGBITS        000001d5 0011d5 000011 00  AX  0   0  
1
  [13] .bankedtext.read  PROGBITS        000001e6 0011e6 000011 00  AX  0   0  
1
  [14] .bankedtext.sbrk  PROGBITS        000001f7 0011f7 00002b 00  AX  0   0  
1
  [15] .bankedtext.write PROGBITS        00000222 001222 00006a 00  AX  0   0  
1
  [16] .fini0            PROGBITS        0000028c 00128c 000000 00  AX  0   0  
1
  [17] .fini4            PROGBITS        0000028c 00128c 000005 00  AX  0   0  
1
  [18] .tramp            PROGBITS        00000291 001291 000008 00  AX  0   0  
1
  [19] .data             PROGBITS        00000299 001299 0001f5 00  WA  0   0  
1
  [20] .bss              NOBITS          0000048e 001299 000012 00  WA  0   0  
1
  [21] .softregs         NOBITS          000004a0 001299 000008 00  WA  0   0  
1
  [26] .rodata.str1.1    PROGBITS        00002fe5 002fe5 000002 01 AMS  0   0  
1


Question is now: What is going wrong. How do I make ld use the 
LDEMUL_PLACE_ORPHAN target hook for those sections not showing up in the 
linker script file? 

I'm kind of lost. My hook function is ready for testing, but actually ld never 
executes it.

Yours,

Bjoern.


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