Wednesday, 18 April 2018

[gccsdk] Absolute binaries giving incorrect __riscosify_control

This is a bug report, but since the bug reporting list has been out of
action for some time, I'm sending it here.

I have ELF and Absolute binaries getting different values of
__riscosify_control from UnixEnv$progname$nonametrans. It's the Absolute
binary that is giving the wrong result, and it only seems to happen when
the binary is run via a RISC OS variable containing the full pathname of
the binary.

This demonstrates the problem:

*Type c.noprocess
#include <stdio.h>
#include <unixlib/local.h>
int __riscosify_control;
int main(int argc,char** argv) {
  (void) argc;
  printf("%s\t ",argv[0]);
  printf("%s\n",(__riscosify_control&__RISCOSIFY_NO_PROCESS) ? "RISCOS"
: "UNIX");
  return 0;
}

*Type run                    (a TaskObey file)
Dir <Obey$Dir>
Set Test$dirname <Obey$Dir>
Set Test$pathname <Test$dirname>.testbin

gcc -o testbin -static -Wl,-s noprocess.c
Set UnixEnv$testbin$nonametrans ""

Echo Binary is ELF
testbin
<Test$dirname>.testbin
<Test$pathname>

Echo Binary is Absolute
elf2aif testbin
testbin
<Test$dirname>.testbin
<Test$pathname>


This is the output I get:

Binary is ELF
HostFS::HardDisc4.$.MyFiles.Transfer.testbin  RISCOS
HostFS::HardDisc4.$.MyFiles.Transfer.testbin  RISCOS
HostFS::HardDisc4.$.MyFiles.Transfer.testbin  RISCOS
Binary is Absolute
HostFS::HardDisc4.$.MyFiles.Transfer.testbin  RISCOS
HostFS::HardDisc4.$.MyFiles.Transfer.testbin  RISCOS
/HostFS::HardDisc4.$/MyFiles/Transfer/testbin UNIX

The binary should output the same text each time, but is wrong the last
time.

I'm using:
  gcc (GCCSDK GCC 4.7.4 Release 3) 4.7.4
  SharedUnixLibrary 1.14
  VirtualRPC-AdjustSA RISCOS 4.39

Regards
Duncan Moore


_______________________________________________
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK

No comments:

Post a Comment