Fix "test cases/common/125 object only target" on Solaris

If object is not built pic, trying to link it into libshr.so fails:

[6/8] Linking target libshr.so.
FAILED: libshr.so
gcc  -o libshr.so 'shr@sha/source2.o' -Wl,--no-undefined -Wl,--as-needed -shared -fPIC -Wl,--start-group -Wl,-soname,libshr.so -Wl,--end-group
Text relocation remains                         referenced
    against symbol                  offset      in file
.text (section)                     0x20        shr@sha/source2.o
ld: fatal: relocations remain against allocatable but non-writable sections
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
pull/7370/head
Alan Coopersmith 5 years ago
parent feef5a1c06
commit e4330eff6d
  1. 2
      test cases/common/125 object only target/obj_generator.py

@ -13,6 +13,8 @@ if __name__ == '__main__':
ofile = sys.argv[3]
if compiler.endswith('cl'):
cmd = [compiler, '/nologo', '/MDd', '/Fo' + ofile, '/c', ifile]
elif sys.platform == 'sunos5':
cmd = [compiler, '-fpic', '-c', ifile, '-o', ofile]
else:
cmd = [compiler, '-c', ifile, '-o', ofile]
sys.exit(subprocess.call(cmd))

Loading…
Cancel
Save