<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">In a given object file for "NOTYPE LOCAL” entries in a data segment with zero size that don’t start with ‘$’ could you append text based on the Num field for the rtems_rtl_obj symbol lookup in cpukit/libdl/rtl-sym.c? Right now it’s a linear lookup on e.g. “.LC2” and stops at the first hit. I haven’t checked that consumers of the lookup can generate the correct name, that is, always have the “Num” field value.</div><div class=""><br class=""></div><div class="">You’d wind up with mangled lookups such as:</div><div class=""><br class=""></div><div class=""><div class=""> 22: 0000002c 0 NOTYPE LOCAL DEFAULT 3 .LC2.Num22</div></div><div class=""><div class=""> 44: 0000013c 0 NOTYPE LOCAL DEFAULT 3 .LC2.Num44</div></div><div class=""><br class=""></div><div class=""> This is from one of my relocatable files grepping for NOTYPE LOCAL. I’ve verified large files also work.</div><div class=""><br class=""></div><div class=""> Num: Value Size Type Bind Vis Ndx Name</div><div class=""> 0: 00000000 0 NOTYPE LOCAL DEFAULT UND </div><div class=""> 14: 00000000 0 NOTYPE LOCAL DEFAULT 3 $d</div><div class=""> 15: 00000000 0 NOTYPE LOCAL DEFAULT 4 $d</div><div class=""> 17: 00000000 0 NOTYPE LOCAL DEFAULT 6 $d</div><div class=""> 18: 00000000 2048 NOTYPE LOCAL DEFAULT 6 env_entries</div><div class=""> 20: 00000800 4 NOTYPE LOCAL DEFAULT 6 env_initialized</div><div class=""> 21: 00000008 0 NOTYPE LOCAL DEFAULT 3 .LC1</div><div class=""> 22: 0000002c 0 NOTYPE LOCAL DEFAULT 3 .LC2</div><div class=""> 23: 00000030 0 NOTYPE LOCAL DEFAULT 3 .LC3</div><div class=""> 25: 00000000 0 NOTYPE LOCAL DEFAULT 1 $t</div><div class=""> 28: 00000050 0 NOTYPE LOCAL DEFAULT 3 .LC4</div><div class=""> 29: 00000058 0 NOTYPE LOCAL DEFAULT 3 .LC5</div><div class=""> 30: 00000080 0 NOTYPE LOCAL DEFAULT 3 .LC6</div><div class=""> 32: 00000094 0 NOTYPE LOCAL DEFAULT 3 .LC7</div><div class=""> 33: 000000c4 0 NOTYPE LOCAL DEFAULT 3 .LC8</div><div class=""> 34: 000000cc 0 NOTYPE LOCAL DEFAULT 3 .LC9</div><div class=""> 35: 000000f4 0 NOTYPE LOCAL DEFAULT 3 .LC10</div><div class=""> 37: 00000130 0 NOTYPE LOCAL DEFAULT 3 $d</div><div class=""> 38: 0000000c 0 NOTYPE LOCAL DEFAULT 4 $d</div><div class=""> 40: 00000804 0 NOTYPE LOCAL DEFAULT 6 $d</div><div class=""> 41: 00000d14 520 NOTYPE LOCAL DEFAULT 6 putenv_trace_ptrs</div><div class=""> 42: 00000690 0 NOTYPE LOCAL DEFAULT 1 $t</div><div class=""> 43: 00000138 0 NOTYPE LOCAL DEFAULT 3 .LC1</div><div class=""> 44: 0000013c 0 NOTYPE LOCAL DEFAULT 3 .LC2 </div><div class=""> 45: 0000014c 0 NOTYPE LOCAL DEFAULT 3 .LC3</div><div class=""> 47: 00000164 0 NOTYPE LOCAL DEFAULT 3 .LC4</div><div class=""><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class="">On Apr 25, 2019, at 07:56 , Peter Dufault <<a href="mailto:dufault@hda.com" class="">dufault@hda.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">I’m porting a large vxWorks application and I’m trying to download “ld -r” files as you can on vxWorks using the run-time loader. At least on ARM I can’t get it to work, it uses the first local address it sees for all occurrences.<br class=""><br class="">Example: Label .LC2 is used in two places, once for the “r” in an fopen() and later for a format string. In both cases the address used is 0x419f14, the address of “r”.<br class=""><br class="">First is the readelf output, then the disassembly, then debugging output from the RTL.<br class=""><br class="">FIRST OCCURRENCE OF .LC2 used as “r” in fopen()<br class="">readelf:<br class="">00000020 0000152f R_ARM_THM_MOVW_ABS_NC 00000008 .LC1<br class="">00000024 00001530 R_ARM_THM_MOVT_ABS 00000008 .LC1<br class="">0000002a 0000162f R_ARM_THM_MOVW_ABS_NC 0000002c .LC2<br class="">0000002e 00001630 R_ARM_THM_MOVT_ABS 0000002c .LC2<br class="">00000034 0000450a R_ARM_THM_CALL 00000000 fopen<br class=""><br class="">Disassemble:<br class=""> if ((fd = fopen(string, "r")) == (0)) {<br class=""> 2a: f240 0100 movw r1, #0<br class=""> 2e: f2c0 0100 movt r1, #0<br class=""> 32: 6878 ldr r0, [r7, #4]<br class=""> 34: f7ff fffe bl 0 <fopen><br class=""><br class="">RTL:<br class="">rtl: THM_MOVT_ABS/THM_MOVW_ABS_NC 0x341f2c0 @ 0x4196dc in bad<br class="">rtl: rel: sym:.LC2(22)=00419f14 type:47 off:0000002a<br class="">rtl: THM_MOVT_ABS/THM_MOVW_ABS_NC 0x7114f649 @ 0x4196e2 in bad<br class="">rtl: rel: sym:.LC2(22)=00419f14 type:48 off:0000002e<br class="">rtl: THM_MOVT_ABS/THM_MOVW_ABS_NC 0x141f2c0 @ 0x4196e6 in bad<br class="">rtl: rel: sym:fopen(69)=000d33c1 type:10 off:00000034<br class=""><br class="">SECOND OCCURRENCE of .LC2 used for the printf format string:<br class=""><br class="">readelf:<br class="">000007a8 00002c2f R_ARM_THM_MOVW_ABS_NC 0000013c .LC2<br class="">000007ac 00002c30 R_ARM_THM_MOVT_ABS 0000013c .LC2<br class="">000007b0 0000330a R_ARM_THM_CALL 00000000 printf<br class=""><br class="">Disassemble:<br class=""> 7a6: 68f9 ldr r1, [r7, #12]<br class=""> 7a8: f240 0000 movw r0, #0<br class=""> 7ac: f2c0 0000 movt r0, #0<br class=""> 7b0: f7ff fffe bl 0 <printf><br class=""><br class="">RTL:<br class="">rtl: rel: sym:.LC2(44)=00419f14 type:47 off:000007a8<br class="">rtl: THM_MOVT_ABS/THM_MOVW_ABS_NC 0x7014f649 @ 0x419e60 in /opt/flatland/arch/arm-stubs-vxstubs/bin/sys-bad<br class="">rtl: rel: sym:.LC2(44)=00419f14 type:48 off:000007ac<br class="">rtl: THM_MOVT_ABS/THM_MOVW_ABS_NC 0x41f2c0 @ 0x419e64 in /opt/flatland/arch/arm-stubs-vxstubs/bin/sys-bad<br class="">rtl: rel: sym:printf(51)=000daac9 type:10 off:000007b0<br class=""><br class="">Peter<br class="">-----------------<br class="">Peter Dufault<br class="">HD Associates, Inc. Software and System Engineering<br class=""><br class="">This email is delivered through the public internet using protocols subject to interception and tampering.<br class=""><br class="">_______________________________________________<br class="">devel mailing list<br class=""><a href="mailto:devel@rtems.org" class="">devel@rtems.org</a><br class="">http://lists.rtems.org/mailman/listinfo/devel</div></div></blockquote></div><br class=""><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span class="Apple-style-span" style="border-collapse: separate; font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; line-height: normal; border-spacing: 0px; -webkit-text-decorations-in-effect: none;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-position: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-stroke-width: 0px;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;">Peter<br class="">-----------------<br class="">Peter Dufault<br class="">HD Associates, Inc. Software and System Engineering</span></font></div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br class=""></span></font></div>This email is delivered through the public internet using protocols subject to interception and tampering.</span></div></span></div></div></div></div></div></div></div></div></div>
</div>
<br class=""></body></html>